1 of 1 people found this helpful
When you set up Go To Related Records (GTRR) and specify a specific layout. The script does not change layouts and no error message is displayed by your script if there are no related records to "go to".
Thus, if there are no related records, you If step is checking the found set on your original layout--which is not going to have an empty found set and thus it fails to detect the fact that there were no related records to go to.
Instead, you need to either check for the existence of related records just before you use GTRR or check for an error code immediately after.
If [ Not IsEmpty ( RelatedTable::ForeingKey ]
If [ Get ( LastError ) = 0 // GTRR found related records]
This is an example of what I consider to be FileMaker's very substandard and inconsistent methods for handling script errors.
For a full run down on what I think is wrong and what might be done to correct it, see this product idea: