ByteTheBullet

Note About Server-Side FM Scripts

Discussion created by ByteTheBullet on Jan 31, 2012
Latest reply on Mar 2, 2012 by Stephen Huston

So I encountered an interesting issue while working on a server-side FM script yesterday. It was a script to import some data from a text file in the Documents directory on the server, and then do a bunch of processing. I'm running FMSA 11, so importing is supported. I had some error-checking code that would add a log entry into a logging table if the import failed for any reason. Anyway, the first attempt at running the script resulted in it apparently hanging. No data was imported. I went to the Server Admin tool, went to disconnect the script connection, and went back to work troubleshooting the script. I made a few changes, ran it, and received an error in the log table. Okay I think, do a little more work, run the script again, and receive the same error. Getting curious, I disabled the error logging routine, ran the script again, and received a different error (code 0). All of these attempts, however, did actually import data from the file. It just seemed that the script would exit immediately after importing the data and report an error condition.

To make a long story short, it turns out that the original run of the script in question did not actually disconnect when I told it to via the server admin. I'm not sure if it was variables retaining values from that first run of the script, error states staying in place, or maybe some sort of script caching issue. I ended up having to shut down the FileMaker Server service in order to get the first script run to disconnect. As soon as I restarted the service and re-ran my modified script, everything worked exactly as planned.

I thought describing my experience might be helpful to another developer encounting a similar issue.

Outcomes