September 27, 200916 yr 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!
September 27, 200916 yr 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 ]
September 27, 200916 yr Author Hah! I had it half right. Thank you for the lesson and the easy fix tip. Maybe now I can sleep.
Create an account or sign in to comment