AnsweredAssumed Answered

Name a global variable in a script.

Question asked by roryduffy on Feb 23, 2017
Latest reply on Mar 9, 2017 by roryduffy

Hi,

 

I hope you're all well.

 

I'd like to create a 'back button' in Filemaker, similar to a browser navigation back button, using the commonly tried-and-tested Global Variable technique.

 

So far, I have got this to work for 1-step back, by setting the following script trigger on layout exit, which is great:

 

1.

Set Variable

( $$Backward )

Value; ( Get ( LayoutName ) )

 

2.

Go to Layout Name by calculation: ( $$Backward )

 

However, I'd like to make this work for multiple steps. I'm aware that as you navigate through the layouts, a script trigger needs to 'log' the browser history. To do this, I tried setting up a sequence of 10 nested IF statements in my script:

 

If

( not ( IsEmpty ( $$Layout01 ) ) )

     If

     ( not ( IsEmpty ( $$Layout02 ) ) )

          If

          ( not ( IsEmpty ( $$Layout03 ) ) )

 

and so on..., and then doing the same in the "Go to Layout" script to determine which Global Variable should be used. Unfortunately, while this worked, with each subsequent level down, Filemaker's speed plummeted to a crawl until I got a spinning beach ball of death.

 

Is there a way in which a Global Variable can be generated automatically/incrementally? I've read online that it can be done, as a "Dynamic Global Variable". Although I've found out how this can be implemented in a field, I can't find anywhere that explains how this can be implemented in a script.

 

Essentially, I'm looking to create 2 scripts:

1. A script trigger activated on Layout Exit, which generates Dynamic Global Variables to 'log' browser history.

2. A go to script that analyses what number Global Variable you're currently on, and then subtract 1 to go to the layout previously logged to that.

 

I believe "Dynamic Global Variables" might be the key to all of this, but I'm also wondering whether the script trigger should be activated on Layout Entry rather than Layout Exit.

 

Thanks,

 

Rory

Outcomes