Having FileMaker Pro Advanced dramatically helps reduce debugging time. For those who aren’t aware, along with its many other benefits, FileMaker Pro Advanced provides:
*Script Debugger: allows you to traverse through any executed script step-by-step
*Data Viewer: allows you to check the value of any field, variable, or random calculation of your choice at any given point (including during the middle of Script Debugger)
After activating Tools->Script Debugger, you’re now ready to debug scripts. You can start a script with a script trigger from any object or from the layout itself. Or you can activate it through a traditional button press.
If a script is already running, turning on the Script Debugger will in normal cases pause the script after the current step finishes and allow you to debug from that point forward. If the account you’re logged into doesn’t have permission to access the script details, the debugger will prompt you once to enter in valid account credentials. Also, if you switch modes (e.g. from browse to find), the script immediately terminates on the current step. Switching between records is fine and if you continue the script, you’ll start from the current layout instead of where the script paused.
For those who have used Script Debugger from earlier versions of FileMaker, please note that FileMaker 10’s debugger is very similar but doesn’t operate entirely the same. If you close the debugger by exiting the window, all remaining steps in the script will be run automatically; the script will not be terminated on the spot. Also, you must leave the Script Debugger on-screen for it to be active. There’s no longer a checkbox to set the Script Debugger on and have it come up whenever a script is activated.
Now, the debugging window is very straightforward. Most of the details are explained here: http://www.filemaker.com/help/html/fmpa_tools.24.2.html
The 3 powerful tools for locating problems in the Script Debugger are:
1. Opening the Data Viewer to look at any value: FileMaker 10’s Data Viewer dynamically changes values with each step and is essential for testing why a field may not be setting correctly
2. Setting a Breakpoint: Breakpoints are essential for checking values in a loop. Walking step-by-step through a long loop isn’t fun. If you run a lengthy loop dozens of times, being able to set a breakpoint right before a loop circles around is critical to quickly diagnosing a problem
3. Setting the next script step: Sometimes, you’ve already isolated a script issue to a small part towards the end of a lengthy script. Even setting breakpoints still means you’ll have to wait for the previous steps to finish. Save yourself the hassle and just skip right towards the problematic section
With this in mind, walk line by line through the script and keep a close eye on which script you’re in, what values you’ve been setting, and whether select statements are directing the script into the places you’re expecting to go. In very rare circumstances, corruption can affect script steps. But in most cases, using all the tools provided will allow you to pinpoint any script issues with ease.
It’s possible to simulate these features in the base FileMaker Pro software with custom dialog boxes, test fields, and other manual techniques but that’s very cumbersome and time-consuming. No serious FileMaker developer should be without FileMaker Pro Advanced. Much of the same concepts for debugging scripts also apply to other programming environments but FileMaker definitely has one of the easiest and most straightforward tools.
