From Dwayne Wright PMP
Certified FileMaker Developer
Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit or other formatting of the posting may fail. For the best experience, please visit the journal directly by clicking (here).
The Save Records As PDF script step allows you to script a process that leverages saving of a found set of FileMaker records as a PDF that can be stored, shared or printed. There are some interesting options for this script step including features such as appending to an existing pdf, automatically opening the newly created file or auto creating an outgoing email (with a compatible email client) and have the file added as an attachment.
There is also the general option of performing with or without a confirmation dialog box for the user running the script. You can also hard code the location on the users machine where the newly created file will be stored.
Although you have to hard code the location of where the file is stored, you can dynamically change it. You might be thinking, “I thought hard coding something meant it is carved in stone?” Well, you can hard code a script variable (see below) and the variable can be dynamically set via a script step previous to the execution of the Save Records As Excel script step.
SET VARIABLE BASICS
Well, I’m not going to even try to cover all the power and flexibility of the Set Variable script step here. You have two choice of a local variable and a global variable. Each has its own unique advantages and drawbacks. I’d have to say the local variable is probably more commonly used simply because FileMaker will define a variable as local by default.
A local variable is defined by adding a single dollar sign in it’s name such as $InvoiceNumber, $ClientID or $Counter. A local variable will store it’s information within a script while that script is running. After the script is finished in it’s execution, the defined local variable will have no value. An advantage of this is like a disposable lighter. When you are done, you throw it away because you never intend to refill it.
A global variable is defined by adding a two dollar sign characters in it’s name such as $$InvoiceRange, $$Array or $$UserPrefs. A global variable will store it’s information within the entire file while the file is open. This way it can be used across scripts or even in-between times that scripts are called upon.
As much as you might think that a global variable would be available from two different FileMaker files during the same session, that is NOT the case. In order to pass data like that between different files, you will need to use global fields or a script result.
APPEND TO PDF
The Append To PDF feature is an addition to the Save Records As PDF script step. So now you can add content to an existing pdf document via a FileMaker script! The implementation of this feature that quickly comes to mind is editing a business analysis report. This could be done on just about any time frame to make a living document of business activity. Another idea that comes to mind is a report that spans multiple files or even solutions.
Where do you find this feature? In ScriptMaker, navigate down to the Records family of script steps on the left side of the ScriptMaker dialog box. There you will see the Save Records As PDF script step, choose that step and bring it over to your executable script step section. When you do that, highlight that script step if it is not already. In the options area for that script, you will see the Append To Existing PDF option.
Although at this point in time, I haven’t implemented this feature for a client or internally, it is quite simple to setup. I just did a quick example myself and it seems to have turned out just fine.
FYI ... I did find out that you cannot append to an open pdf document. This could be something you run into from time to time.
More info about the author and FileMaker in general, contact me at email@example.com.
© 2007 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.