crow Posted October 9, 2008 Posted October 9, 2008 I have a script that performs a find then exports the records then does other things. The problem is if there are no records to be found it stops the rest of the script and displays a dialogue box that says “No records match this set of find request” If it finds nothing then I want it to find nothing and export nothing and move on to the next step. Not stop the script. How can I over come this?
mr_vodka Posted October 9, 2008 Posted October 9, 2008 Set Error capture on right before the perform find [] step. Then can use and If statement along with get(lasterror) or Get(FoundCount) to do stuff only when there is a found set or viceversa.
crow Posted October 16, 2008 Author Posted October 16, 2008 (edited) I set error capture to no. But I still get the same error. I don’t want to mess with if then statements. If I did someone could still change things so that there are no records after if then statements and it would stop the script dead again. I just want it to continue on without the message needing someone to click continue. I am having a similar issue with XML files. When another scripts import them, some do not have data. When this happens I get an error box saying “The main XML document cannot be empty” I have checked “Perform without dialog” but I still get one, and I have to click ok for script to continue. How can I get these scripts to happen without requiring user interaction? I don’t care if there is no data to export or no data in the XML file just go one to the next step. Edited October 16, 2008 by Guest
LaRetta Posted October 16, 2008 Posted October 16, 2008 Hi crowman, John suggested setting error capture ON, not off (you said 'no', unless that was a typo). If error capture is ON and no records are found to export then your script will just continue without the dialog box popping up. But it is cleaner if you skip the export step if no records found, so script might look like this: Set Error Capture [ On ] Perform Find [ Restore ] [color:red]If [ Get ( FoundCount ) ] Export records End If ... put the rest of your script here. You can use If [ Get ( LastError ) ] instead of the red portion or you can even trap for a specific error. When not finding records, I prefer testing for found count instead of specific error capture but that's just a personal preference. So setting error capture ON stops FileMaker's dialog. But be sure to handle any possible errors within your script yourself (or ignore them entirely as you wish to do in this case). LaRetta :wink2:
Recommended Posts
This topic is 5883 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