For Programmers: Free Programming Magazines  


Home > Archive > Clarion > August 2005 > Deleting Multiple Records with Child File









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Deleting Multiple Records with Child File
picnic@earthlink.net

2005-08-04, 4:59 pm

I need to loop through a file and delete multiple records while at the
same time deleting related child records. Relationships are set up
correctly and not the problem. In the first set of code only the first
record that meets the criteria (and it's related child records) are
deleted. I need to delete all records where the job id meets the
criteria.

In the second set of code, all the records that meet the job id
criteria are deleted but not the child files.

I need to get the first set of code working and I am at a total loss as
to why it is only deleting the first record. I did a Message on the 4
pieces of the criteria prior to the break and got the following
results. Why would GetEOF be True after the deleting of the first
record? Please help.

Message(Access:XJOBDTL.Next()) = 5
Message(Access:XJOBDTL.GetEOF()) = 1
JDT:JobID = 95
JHD:JobID = 95

! First Set of Code - With RI in place
Clear(JDT:Record)
JDT:JobID = JHD:JobID
Set(JDT:JobIDKey,JDT:JobIDKey)
Loop
If Access:XJOBDTL.Next() Or Access:XJOBDTL.GetEOF() Or JDT:JobID <>
JHD:JobID Then
Break
Else
Relate:XJOBDTL.Delete(0)
End
End


! Second Set of Code - No RI in place
Clear(JDT:Record)
JDT:JobID = JHD:JobID
Set(JDT:JobIDKey,JDT:JobIDKey)
Loop
If Access:XJOBDTL.Next() Or Access:XJOBDTL.GetEOF() Or JDT:JobID <>
JHD:JobID Then
Break
Else
Delete(XJOBDTL)
End
End

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com