Creating script sequence tasks
Create a script sequence scheduled task to run system scripts in sequence with a FileMaker script. You can choose to run a pre-processing system script, a post-processing system script, or both.
For example, create a script sequence that first runs a pre-processing system script that validates and reformats a text file exported from another database. Next, the script sequence runs a FileMaker script that imports the text file, combines it with data stored in a FileMaker Pro database, and generates multiple personalized reports in Excel format (XLSX). Lastly, the script sequence runs a post-processing system script that creates a ZIP file of the reports and places them into a download directory for users.
When creating system scripts and FileMaker scripts for a script sequence:
- The pre-processing script (if one is specified) must return a value of 0 (zero) in order for the script sequence to proceed to the FileMaker script.
- The FileMaker script must complete successfully in order for the script sequence to proceed to the post-processing script (if one is specified). Scripting errors that do not abort the FileMaker Script will allow the sequence to proceed. See FileMaker Pro Help about handling errors in scripts.
- The post-processing script (if one is specified) must return a value of 0 (zero) in order for the schedule to complete successfully.
- You can use the Documents folder as a shared location for passing import and export files between pre-processing scripts, FileMaker scripts, and post-processing scripts in Script Sequence scheduled tasks. The Documents folder is in the same folder as the server’s Backups, Databases, and Scripts folder.
- You must include error-handling and branching logic in your system scripts. Make sure that the script syntax is correct and does not stop responding because of infinite loops or the availability of external resources. You can select End the schedule if the timeout is reached to stop the script sequence schedule if the sequence of scripts takes longer to run than the specified time limit, or if the Database Server stops. If you do not select this option and a system script stops responding, look in the Event.log file for the process ID of the script to terminate. (See Event log.)
For information about FileMaker script steps and functions, see FileMaker Pro Help.