Recurrence in triggered scripts

Recurrence can be really useful. But there are occasions when it is not exactly what you want. For example what happens when you have a script triggered on layout load that goes to another layout then returns? Recursive behaviour is unlikely to be required.

There are a few options to avoid looping ad infinitum. First, and most obvious, is to set a variable to flag the first time the script runs then exit or halt:

Set Variable [$$scriptTrigger; Value:$$scriptTrigger +1]
If [$$scriptTrigger > 1]
Set Variable [$$scriptTrigger; Value:””]
Exit Script [“We exited the script because it is running more than once”]
Else
Go to Layout [“Other Layout” (Table)]
# The script steps we actually want to trigger go here
Go to Layout [original layout]
End If

You can use the Halt Script step in place of Exit Script but it is better to exit with a meaningful value.

Damian Kelly

Damian has been a database developer with Linear Blue since 2007. During this time he has developed complex FileMaker solutions in a broad range of industries from Finance and Investment to Manufacturing to New Media Promotion. Damian graduated in Production Engineering from the University of Hertfordshire in 1996, attained his Masters of Engineering from Kingston University in 1997 and MBA from Heriot Watt in 2006. He holds certification in FileMaker versions 7 through 12 and in Oracle MySQL 5.

More Posts - Website

Leave a Reply