I came across a blog post recently which focused on an issue where a script, run from FileMaker Server, kept failing. The solution outlined how to pause the script in question. You can read that post here.
Over the years, I’ve had to deal with the need to slow down a script run by FileMaker Server many times. I’d like to take this opportunity to share how I do it.
I found, for example, that if I created a server-side script which contained an export/import process, there were times that the script didn’t seem to wait for the export to complete before trying to import from the file created by the previous step. As a result, the script would either throw an error or simply not complete the process as expected. The answer, if you can’t tell where I’m heading, is to place a pause between these two script steps. In other words, export, pause, and then import.
For FileMaker 12, you can simply use the Pause/Resume Script step because it is compatible with FileMaker Server. But what do you do when you need to pause a script being executed by FileMaker Server with an earlier version of FileMaker?
Note: You can check script step compatibility by using the Show Compatibility menu located at the bottom-left of the Edit Script dialog.
My approach has been to create a utility script that has the sole purpose of creating a “pause” affect in my scripts that are run from FileMaker Server. I name the script “ServerPause (Value)” and it contains the following steps:
Set Variable [$pause_value; Value: Get ( ScriptParameter )]
Set Variable [$counter; Value:0]
Loop
Set Variable [$counter; $counter + 1]
Exit Loop If [$counter > $pause_value]
End Loop
I insert this script as a sub-script wherever I need to in the primary script called by FileMaker Server. Since this script is called as a subscript in the parent, I can pass whatever value I wish to adjust the pause. I can also edit this value without the need to modify the actual “pause” script itself. I usually start with a value of 10000 and adjust as necessary. It’s also important to keep in mind that this isn’t a real pause; FileMaker is still running a script.
If you’ve run into this problem, how have you solved it?
Hi.
I did not stumble on that bug thankfully. But I’ve made a similar script for other purpose, except mine “Wait” allows to wait for a precise amount of time
Wait (seconds)
Set Variable [$seconds; Value:Get ( ScriptParameter )]
If [$seconds>0]
Set Variable [$timeout; Value:Get ( CurrentTime )+$seconds]
Loop
Exit Loop If [Get ( CurrentTime ) ≥ $timeout]
End Loop
End If