With the release of FileMaker 16, we have seen a great number of new and improved script steps. FileMaker 16 extended the capability of the Save as PDF script step, now allowing it to work partially with WebDirect, FileMaker Go, and Server, however there are a few things of note.
As documented by FileMaker, the limitations are as follows.
A very useful feature, append to PDF allows you to tie together multiple reports into a single document and so not being able to use it in FM Go can pose a bit of a problem. Using some of the new steps allowed in FileMaker 16, I came up with a work-around.
My first thought was to insert from URL into a variable (a new feature added in FMP v16). However after testing this, I discovered an issue with inserting binary files into variables in the Insert from URL script step in v16.
My solution is to use one global container field that will hold the PDF. Then pass the container field as a base64 encoded variable from the server side script to the script called from FileMaker Go. This solution relies on the Perform Script on Server (PSOS) script step, so it can only be utilized for hosted databases.
PSOS is great for a lot of tasks. Running resource heavy tasks on the server can improve speed and performance from the client’s perspective. However it is worth mentioning a few of the common errors and things to prepare for when using PSOS.
In my demo file I have two separate reports that I am using to generate a single PDF. There are two scripts that are making this happen.
iOS_Save_Appended_PDF is the script tied to the button on the landing page that calls the PSOS script and checks for errors. If the PSOS script runs successfully, it grabs the Base64 encoded PDF as a script result and then inserts it into the global container field, and then exports it, which will actually open the saved PDF in FileMaker Go.
PSOS_Append_PDFs [$PDF] is the second script, which is run on the server and is called from the first script. This script generates and appends the reports. In my demo I’ve left out steps to bring up the exact reports. Because this script is getting run on the server, the context for the report will need to be set here (or in a subscript) called by this script. You will need to pass parameters in order for the script to perform a find on the set or records you wish to include in your report. After the PDF is generated, it is inserted into the global container field, then a Base64 encoded variable is set to the script result.
~ Kate Waldhauser
Your email address will not be published. Required fields are marked *
Comment *
Name
Email
Website
Save my name, email, and website in this browser for the next time I comment.
Post Comment