Jump to content
Sign in to follow this  
Drew Sanderson

Scripted delete record best practice

Recommended Posts

What steps do you take when scripting a delete record both in general and specifically when doing a go to related record?

Edited by Guest

Share this post


Link to post
Share on other sites

Making sure that you have the record(s) that you definitely want to delete as the found set. You should make sure that you properly error trap, especially when using GTRR as if there are none, you could be deleting out parent records.

Share this post


Link to post
Share on other sites

What error trapping precautions do you take? Check the parent table? Check the found count?

Edited by Guest

Share this post


Link to post
Share on other sites

First I check to see if there is a related record.

If [ IsEmpty ( Child::ChildID ) ]

Set Error Capture [On]

Go to Related Records [show related only]

If [ Get (LastError) ]

Show Custom Dialog ["Error"]

Else

do something

End If

This is okay if you are using GTRR for the current parent record.

However, if you are trying to match on the found set, things are a little different for capturing the error code.

If none of the parent records have matching children records, then it should result in a 401 error.

If the first parent record does not have related records but some of the other parent records do, then it will result in a 101 error.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.