Macfreq Posted December 12, 2007 Posted December 12, 2007 I currently use an If statement that checks for the last error of 101 to detect if there are no related records before continuing in a script. Is there a better way to test for no related records in a script? I currently do this: Go to Related Record [show only related records; From table: ...] If [Get (LastError) = 101] Exit Script End If Continue on with script Kind of a basic question, but checking for a general error number of 101 is kind of risky. Thanks.
David Jondreau Posted December 12, 2007 Posted December 12, 2007 Yes, it is risky. There are issues with the error codes and GTRR. I prefer to check for related records before the GTRR. If[Count(related_table::primary_Key)] Go to related record Else Show Custom Dialog["There are no related records."] Exit Script End If See this thread for an overview.
Fenton Posted December 12, 2007 Posted December 12, 2007 According the FileMaker's Jimmy Jones, the IsEmpty (relationship::key) test is optimized for this functionality.
Lee Smith Posted December 12, 2007 Posted December 12, 2007 I think I read this to say the same thing. http://www.filemaker.com/help/FunctionsRef-311.html Lee
Macfreq Posted December 12, 2007 Author Posted December 12, 2007 Thanks guys! I'm going to update the scripts and sleep easier now.
fabriceN Posted December 12, 2007 Posted December 12, 2007 Be careful with matching foundset GTRR, for which this won't work. Also, ensure that all your privilege sets give access to destination layout. You can have related records without having the permission to GTRR.
Recommended Posts
This topic is 6250 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