John Chamberlain Posted March 28, 2018 Posted March 28, 2018 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?
Gilbert13 Posted March 28, 2018 Posted March 28, 2018 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
Fitch Posted March 29, 2018 Posted March 29, 2018 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.
Recommended Posts
This topic is 2431 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