Seven Tips for FileMaker Scripts
Simplify development in FileMaker Pro with these helpful script tips.
We’ve been writing FileMaker scripts for over 25 years now (ever since FileMaker Pro 2.0, when the ScriptMaker first appeared) and we’ve developed our own set of best practices in terms of managing them here at The Support Group. Every FileMaker developer has his or her own set of methods, preferences, styles, etc., but we all agree that writing and maintaining scripts properly can save you a lot of time and frustration in the long run. Whether you’re an experienced FileMaker developer or new to development, you should find these seven scripting tips useful.
7 FileMaker Script Tips
- Always explain the purpose of your script. Focus on why you are performing a script as opposed to what it does. For example:
- Try writing your scripts in all comments first. Write out the workflow and business logic then go back and fill in the actual script steps to execute the business logic.
- Use consistent naming conventions and try to limit the use of abbreviations. If abbreviations are necessary, use standard abbreviations only. For example, use “dept” rather than “depart” for department.
- If you are going to do a Find that requires you to leave your current layout, be sure to enter Find Mode first so that you don’t inadvertently load records from the found set of the table occurrences.
- After performing a find it’s usually a good idea to check for any errors. Instead of looking for every type of error individually you can look for all errors using get(lasterror) <> 0
- Add an Exit Script step or an extra blank line at the end of all your scripts. This will allow you to perform the last “real” script step without leaving the FileMaker Pro Advanced script debugger tool.
- Organize your scripts into folders by module as you go so that they are right where you expect them to be.
If you’re interested in learning more about FileMaker scripting, you can register for our scripting training course. In this scripting course you’ll learn how to automate common searches, edit data, generate reports and send emails. You’ll also explore some advanced functions such as custom dialogs, logical branching, looping and script triggers.
Originally published at www.supportgroup.com on July 12, 2017.