scottworld

"Set Error Capture On" should work on server scripts

Discussion created by scottworld on Aug 27, 2016
Latest reply on Aug 29, 2016 by TSGal

When running a scheduled script on FileMaker Server, FileMaker Server needs to respect the "Set Error Capture ON" script step.

 

FileMaker's documentation clearly states that by using the "Set Error Capture On" script step, that you can SUPPRESS FileMaker's error messages. Yet it has absolutely ZERO effect when running a script on the server.

 

if you:

(1) have a script that performs a find then returns a found count of zero, or

(2) have a script that loops through records and exits the loop after the last record,

 

then:

FileMaker Server will erroneously tell you that your script DIDN'T COMPLETE PROPERLY BECAUSE OF A SCRIPT ERROR.

 

This is absolutely false information, because of all 3 of these reasons:

 

(a) the script DID complete properly.

(b) both the found count of zero and exiting the loop after the last record are both EXPECTED CONDITIONS which shouldn't be designated as errors... they are EXPECTED CONDITIONS when you are scripting for those very conditions within the script, and

(c) WE TURNED ON SET ERROR CAPTURE at the very beginning of the script! Set Error Capture on should suppress FileMaker's error messages.

 

There may also be OTHER perfectly normal scenarios where FileMaker Server returns an erroneous error, but above are the two scenarios that we are currently aware of.

 

EXPECTED RESULT: FileMaker Server should only return errors if a real error was actually encountered. Even if you've turned "'Set Error Capture" on in your script, FileMaker Server will STILL return an error status message... even if your script ran completely successfully, and even if your script did every single thing that you wanted it to do.

 

These are the current workarounds for these 2 scenarios above:

1. To workaround the found set issue, you must always keep at least 1 record in your table and then you have to perform a "Show All Records" script step after the "Perform Find" script step. But this is STILL a problematic workaround, because this throws off your expected found set for any script steps that you're about to perform next!

2. To workaround the looping problem, you have to tell the script to exit the loop if Get (RecordNumber) = Get (FoundCount), instead of exiting the loop after the last record.

Outcomes