If a script is used to take the user to that layout in the first place, then yes.
Define a global text field (you could use a global variable, but I prefer global fields)
In your script that takes the user to the layout in the first place, add this step:
Set Field [table::yourglobalfield; get(layoutname)]
Go To Layout[yourlayout]
Now you can used this saved layout name to return:
Simply use Go To Layout in your script and specify: "Layout Name by Calculation" and enter table::yourglobalfield in the specify calculation dialog.
I don't see that Get (layout name) in my version of FileMaker. In which version was it introduced? Thanks.
Get ( LayoutName ) was introduced in vs. 7. Prior to that, it would be Status ( CurrentLayoutName ) but it is a function and not a scriptstep. You would set the global field with that value and then refer to the global field in the Go To Layout [ by calculation ] portion.
Another way to return to your original layout (if you start by switching layouts), is to end with a Go To Layout [ original layout ]. I don't believe this option to 'return to the original' was available prior to vs. 7. Some Developers don't like using Go To Layout [ original layout ] because they want to control it. If I wrote the script and if I know how the script works and that it will return to the original, why NOT use it?
I tested go to layout [original layout] to see if this would work and it doesn't seem to work for me. I've always assumed, apparently correctly, that this step returns you to the layout that was current at the start of a script's execution.
I created a one line script: Go To Layout [Layout Name]
I created a second script: Go To Layout [Original Layout]
When I run the first script it takes me from my current layout to the named layout. When I then run the second script to return to my first layout, as expected, nothing happens.
The problem here is that the name or number of the "original layout" specified in the first script is not available to the "return" script when it executes unless we store either the layout's name or number in a field or global variable before changing layouts in the first script.
"that was current at the start of a script's execution."
Fair enough and if you're right and I'm wrong, the original poster can let us know. :smileywink:
18 months later - and it's just what I wanted / needed and it works very nicely.
Thanks so much