5 Replies Latest reply on Feb 13, 2014 10:23 AM by philmodjunk

    Bug with running script on server

    scottworld

      Summary

      Bug with running script on server

      Product

      FileMaker Server

      Version

      12.0.x

      Operating system version

      OS X 10.8.x

      Description of the issue

      When using FileMaker Server to run a server-side script, there is a bug if the script contains a loop in it that loops through records.

      At the end of the loop, the script step "Go To Record [Next; Exit After Last]" will yield an error message in the FileMaker Server log after the last record.

      And because it erroneously yields an error message, the server script will abort unexpectedly unless the first step of the script is "Allow User Abort [Off]".

      However, to workaround this bug and to prevent the error from ever cropping up in the first place, the user must add an additional script step BEFORE the "Go To Record [Next; Exit After Last]" script step, which is:

      Exit Loop If [Get (RecordNumber) = Get (FoundCount)]

      That extra script step will prevent the error from happening.

      So in order to prevent any problems with FileMaker Server running a server-side script that contains a loop that loops through records, the entire script needs to look something like this:

      Allow User Abort [Off]
      Go To Record [First]
      Loop
      …(do stuff here)…
      Exit Loop If [Get (RecordNumber) = Get (FoundCount)]
      Go To Record [Next; Exit After Last]
      End Loop

      Thanks,
      Scott