Understanding Perform Script on Server
When FileMaker 13 was released, one of its sleeper features was Perform Script on Server. Yeah, developer’s recognized it, but didn’t really know how to value its power.
With the subsequent release of FileMaker 14, and FileMaker Go 14 in particular, the advantages of Perform Script on Server simply can’t be overlooked by anyone creating solutions within FileMaker Pro.
If your FileMaker solution has any number of users, beyond a very small number, then the performance gains can be quite significant for certain tasks.
While certain script steps like Export Field Contents cannot be used with Perform Script on Server, there is a wealth of functionality which can be harnessed through the use of server side plug-ins. Because of what you can do on the server side, there are few, if any limitations. Need to communicate with other web services via ODBC, SQL, REST, SOAP (pick your acronym)? Want to send bulk HTML email using an online service like Amazon’s SES mail sending? Need to automate a routine import which normally task just a bit too long?
Using PSoS is simply a matter of understanding what’s happening server side and knowing how to troubleshoot. Fortunately, this video will provide you with all the know-how!
Comments
IsServer bug?
My server setup is that I am the client and the server is a separate machine. When I try the Perform Script on Server Button, it thinks the script isn't on the server. Shouldn't the is on server check be on the server not the client? LeftWords ( Get ( ApplicationVersion ) ; 1 ) = "Server" should be LeftWords ( Get ( HostApplicationVersion ) ; 1 ) = "Server"?
Jason Bourque
Doesn't work for me
The button run "Run Script On Server" doesn't work for me, I get the "This file is not hosted on filemaker server...". It looks like your server setup is on the machine you develop on. My server is a different machine. So shouldn't the "LeftWords ( Get ( ApplicationVersion ) ; 1 ) = "Server"" be for the server and be "LeftWords ( Get ( HostApplicationVersion ) ; 1 ) = "Server"? Once I change this demo file works fine.
Jason Bourque
Context is from the machine running the script
Hey Jason,
Using Get ( HostApplicationVersion ) from a FileMaker client simply tells you that the server is actually Server versus a Peer-to-Peer connection to another copy of FileMaker Pro.
When a script is run on the server side, using PSOS, then the check to make sure it is being run on server is what you're after. Depending on how you are checking for things you may certainly want to use the other functions.
In the video, you can see that my copy of FileMaker Server is running on a separate box under Windows 2012 R2.
I hope this helps out.
-- Matt Petrowsky - ISO FileMaker Magazine Editor
Server side import
Great video! To do a server side import we had a container field with external storage that the file was dropped into. We had to set up an alternate folder instead of use the default external storage location to make it work, but then the server picks up the file from the specified path and does the import and data modification.
Brad Cranston
Cranston IT
PSOS
Thanks Matt! Your recommendation to create a blank startup table and layout finally exorcised these pesky authentication failure warnings that has been haunting our status logs when doing PSOS.