tdsiebert Posted October 19, 2005 Posted October 19, 2005 I have a script which deletes related records using the GTRR and DELETE RECORDS script steps. The script seems to work perfectly 99.9% of the time but has on two occasions deleted records in the parent table not the related table. And yes, there is an IF step directly before the GTRR which checks for the presence of related records: a symplified version of the syntax I used is IF[count(related table:related table ID)>0] GTRR Delete Record ELSE Exit Script End IF My question is are there any situations (record locking, multi user, multi window?) in FM7 which would result in a failure of the GTRR step to actually go to related table assuming that the IF statement was valid? Thanks, Ted
T-Square Posted October 19, 2005 Posted October 19, 2005 Why don't you set up the relationship so that related records are deleted when the parent is deleted? No need for scripts at all, 100% reliable. David
tdsiebert Posted October 21, 2005 Author Posted October 21, 2005 David, Yes that would work well, but I am not deleting the parent record only the related ones. Thanks for your input. Ted
T-Square Posted October 22, 2005 Posted October 22, 2005 I don't know about your original record-locking question, but maybe you could avoid it by using a portal and deleting portal rows until you get a portal row error? Basically, you set up a loop that goes to the first row of the portal and deletes it until there are no related rows and FM throws an error. Cheers, David
Recommended Posts
This topic is 7029 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