3 Replies Latest reply on Aug 29, 2016 10:54 AM by TSGal

    "Set Error Capture On" should work on server scripts

    scottworld

      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.

        • 1. Re: "Set Error Capture On" should work on server scripts
          TSGal

          scottworld:

           

          Thank you for your post.

           

          When you perform a Find and no records are found, a dialog box appears letting you know no records were found.  To suppress the dialog box from appearing, use Set Error Capture On.  The error still occurs (401), but the error is trapped and can be evaluated.

           

          In FileMaker Server, even though Set Error Capture is turned on and dialog boxes cannot be displayed, the error is still logged in the Event.log file.  These errors show in the Event.log as Information messages; not as a "DIDN'T COMPLETE PROPERLY BECAUSE OF A SCRIPT ERROR."  If you get an error that a script didn't complete, then step through the script to determine why it is failing.

           

          If you don't want the two informational error messages to appear in your Event.log (401 for no records in found set, or 101 for skipping beyond the last record), then use your workarounds.

           

          Another customer has made a similar request, so I have attached your post to the original request.  When more information becomes available, I will let you know.

           

          TSGal

          FileMaker, Inc.

          2 of 2 people found this helpful
          • 2. Re: "Set Error Capture On" should work on server scripts
            scottworld

            Hi TSGal,

             

            Thanks for the post. That's totally fine that those errors show up in the Event.log as information messages, because that's what they are: informational error messages.

             

            However, our primary concern -- and the original reason for this post -- is how the "Schedules" screen within the FileMaker Server Admin Console reacts to these informational error messages. (I'm referring to the "Schedules" screen which you can get to by launching the Admin Console and then clicking on the word "Schedules" in the left margin.)

             

            This Schedules screen displays a status of "Script Error" underneath the "Status" column for that particular script. So the word "error" on the Schedules screen leads the FileMaker Developer to believe that an actual error had occurred, instead of just an information message.

             

            The Schedules screen shouldn't really say "Script Error" unless an actual error occurred.

             

            But in the meantime, we will do these workarounds. Although the "found set" workaround is kind of unintuitive & not a great database technique, because it requires us to always keep 1 fake record in a table where we are TRYING to keep that table to a found set of 0.

            • 3. Re: "Set Error Capture On" should work on server scripts
              TSGal

              scottworld:

               

              Thanks for the explanation about the "FileMaker script error" listing under Admin Console > Schedules > Status column.  I can see how this could be confusing.  I have attached this additional information to the original report.

               

              TSGal

              FileMaker, Inc.