Dr. Evil Posted September 27, 2009 Posted September 27, 2009 How can I better control a find that returns no match? I'm performing a find in my script and have an [if LastError = 0 continue with script, if not exit]. This would work ok, but when find comes up with an error File Maker gives user an option to "Continue" or "Modify". I don't want to give user an option, maybe show a custom dialogue saying why script halted but that is it. I don't want scrip to stall, just to act accordingly. I thought I could just turn error capture off an I would be good, but that did not work. Any ideas on how I could smooth this bump? THANKS!
Genx Posted September 27, 2009 Posted September 27, 2009 Okay: 1) Set Error Capture a) ON -> Switches Error Capture to a state where you can deal with error's in your script. When it is on, error's are dealt with by you manually. : OFF -> Switches Error Capture to a state where the system captures them and deal's with them by presenting an appropriate dialog to the end user. Get(LastError) will work properly when Set Error Capture is On E.g. Pseudo Code: Set Error Capture[On] Enter Find Mode[] Set Field["a";"Blah"] Perform Find[] If[ Get(LastError) = 401 ] Show Custom Dialog["Could not find matching records, please try again."] # do other stuff related to no results here Else # deal with successfully found records here. # you might also want to check for other errors here / do a general error check with Get(LastError) > 0 End If Set Error Capture[ Off ]
Dr. Evil Posted September 27, 2009 Author Posted September 27, 2009 Hah! I had it half right. Thank you for the lesson and the easy fix tip. Maybe now I can sleep.
Recommended Posts
This topic is 5537 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