Disable Script Steps

The Set Next Step button (Section 19.2) lets you skip script steps manually, but it's not much help unless you remember to click it at the right time. Instead, FileMaker Advanced lets you specify which steps you want to disable whenever the script runs. For example, looping scripts can take a long time to run in large databases, so temporarily disable your Loop and End Loop steps while you're checking other parts of the script. After one loop, the script continues on its merry way so you can continue debugging. (See the box on Section 19.1.1.5 for another cool way to get out of a loop.) You should also disable script steps that may do something destructive to your datarelying on Set Next Step and your mouse button is leaving an awful lot to chance.

To disable a script step (see Figure 19-5), open the script in ScriptMaker, then highlight the step you want to disable. Click the Disable button in the Edit Script dialog box. FileMaker puts two slashes in front of disabled script steps so you can identify them. To enable a step again, select it. The Disable button changes to Enable; click it and the step is back in business.

Figure 19-5. The last Perform Script step, which is highlighted, is disabled in this illustration. When a disabled script step is highlighted the Disable button reads "Enable." You need FileMaker Advanced and script editing privileges to enable or disable a script step.

Disabling script steps is useful for debugging, but it can have long-term use, too. Any step that you disable in FileMaker Advanced gets skipped whenever someone runs iteven in FileMaker Pro. So say your company has a semi-regular promotion, that creates discounts for a limited period.

You don't have to write two different scripts, one with the discount and one without, and then worry about some kind of test to make them available on a button or in the script menu at the proper times. Write one script, making sure the discount creation steps are separate from the main process. Then you can enable the pertinent steps when the promotion starts and disable them when it's over, with very little fuss or muss.

Категории