Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2431 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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