March 28, 20187 yr I want to exit a script if a search produces no records' I tried this: Go to Layout ["Client Data" (Client Data)] Perform Find (Restore) If [ Get (Foundcount) = 0 ] Exit Script End If What am I doing wrong?
March 28, 20187 yr Hi John, You need to add the criteria you want to find to your script: Go to Layout ["Client Data" (Client Data)] Enter in find mode Set field Perform find If [ Get (Foundcount) = 0 ] Much success
March 29, 20187 yr John, when you say "it doesn't work" what do you mean? Gilbert's idea is a variation that makes your script easier to debug, but wouldn't necessarily change the result. (PS if you use this form, it's optimal to go to Find mode before changing layouts.) One thing you might be missing is a "Set Error Capture [On]" step before the Perform Find. That way you won't get a FileMaker error dialog, and the script should exit as expected. But the user might be confused if you leave them on a layout with zero records, so you may want to handle that before you exit.
Create an account or sign in to comment