ddreese Posted March 13, 2003 Posted March 13, 2003 I'm having problems with a script I have. In my 'significant other' file, I allow the users to enter/edit significant other information. I have an 'ok' button which takes them back to a layout in another file. It also runs a script to go to the perpetrator master file. The script in the perpetrator master file is supposed to delete all the related records (related to the significant other file based on a field called Case ID). After it deletes the records, it goes back to the perp master file and enters the new information if the 'Perpetrator' field in the significant other file is set to something other than 'N/A'. I'm doing this because anytime someone would mistakenly flag someone as a perp if they aren't really a perp, or edit their name/address/ssn/whatever else. This should keep all the data as current as possible. Now the problems that I'm having are in the perp master field. It seems no matter how I make my script go, it leaves one of the perps behind from that last update. Breifly, my script is: In Sig other: .... - Go to related record (Based on the CaseID relationship, this should bring up the current related files in the perp master?) - Run external script (in perp master to remove the files) .... In Perp master: - Go to Record/Request (First) - Loop - Delete Record/Request - Goto Record/Request (Next, Exist after last) - End Loop That's basically all I have, is there a way that I can just delete all related records? I tried the delete all records command, but that didn't delete just the related records, it did all the records in the file.
ddreese Posted March 13, 2003 Author Posted March 13, 2003 I think I fixed it. For some reason I had the 'Show only related record' checkbox marked on the Go to related record command. I didn't even know what it did, but I couldn't get it to work before so I thought I'd check it. Now all the script in the perp database contains now is 'delete all records', it seems to work fine.
LiveOak Posted March 13, 2003 Posted March 13, 2003 Remember, if you don't use the "show" option, the found set can contain an indeterminate number of records. If you want to isolate a set of related records you need to use the show option. If you use this option, a delete all records is the way to go. The reason the looping delete didn't work is found in watching the prgression of the current record pointer. If you go to the first record and delete it, you are now on the second record. If you then go to the next record and loop, you are on the third record, having skipped the second. You then delete the third record, landing on the fourth, and skip to the fifth. Using this method you don't delete any of the even records, NOT ALL OF THE FOUND RECORDS! -bd
Pupiweb Posted March 13, 2003 Posted March 13, 2003 That's basically all I have, is there a way that I can just delete all related records? I tried the delete all records command, but that didn't delete just the related records, it did all the records in the file. Try with: Go to related record, SHOW Perform script in target file Delete All records
ddreese Posted March 14, 2003 Author Posted March 14, 2003 Thanks guys, you're right. So the 'Show only record' thing shows JUST the related records, then? I just realized the same thing this morning after I tried it, and after I was done swearing I thought I'd come back here and check up. LiveOak - thanks for the explination, I figured it was something strange like that. Thanks again, guys!
Recommended Posts
This topic is 7929 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now