It works the same in .FP7 files also.
A "stack" in data structure jargon is a Last In First Out or LIFO list of values. Since in this case, we want to go to the most recent previous layout, then to the most recent after that and so forth with each click of the button, this is a structure that will work for us. "Push" adds a new value to the lsit. "Pop" removes the most recently added value. You can picture a stack of disposable drink cups with a value written on each cup in a dispensor where you can only add and remove cups from the same end of the stack of cups.
Use the OnLayoutExit Script trigger to perform this script:
If [ Not $$NoPush ]
Set Variable [$$LayoutStack ; List ( Get ( LayoutName ) ; $$LayoutStack ) ]
Set Variable [$$NoPush ; value: True ]
Go To Layout [ GetValue ( $$LayoutStack ; 1 ) ]
Set Variable [$$NoPush ; value: False ]
Set Variable [$$LayoutStack ; RightValues ( $$LayoutStack ; ValueCount ( $$LayoutStack ) - 1 ]
This is what I did so far:
I created a script named "Push and Pop" and put in all the script steps properly.
In Manage | Layouts | Script Triggers, I checked OnLayoutExit and added the "Push and Pop" Script.
I created 2 buttons (left and right), highlighted both buttons and assigned the "Push and Pop" script at the same time.
When I hit either button, it highlights, but does nothing.
I went wrong somewhere. Am I supposed to enter an optional script parameter for it to know which way to go? Am I supposed to seperate the script into "push" and "pop", and if so, which is back and which is forward?
Push is one script and Pop is the second.
Ony the first three lines, Push, should be performed by the script trigger.
Your back button then performs "Pop" to go back to the previous layout.
Note: The $$NoPush variable is used so that no layout name is pushed on the stack when the "pop" trigger trips the OnLayoutExit Trigger when going back to the previous layout.
I got the back button to work by entering "True" as a script parameter into the "pop" script.
When I enter "False" as a script parameter into the same "pop" script assigned to the forward button, it goes back. How do i get the forward button to go forward?
I don't understand your post. There are no references to script parameters in either script.
A forward button would require a different set of scripts as this method deletes each layout name as it is "popped" off the stack.
Thank you so much for your example PhilModJunk. I implemented it with some adjustments into my solution & it is working quite well. I may need to adjust it again to be able to go back to the prior found set (or prior current record) if the stack includes the same layout multiple times but with different found sets. Have you accomplished this in any of your solutions? If so, what is the best (simplest) way to remember a found set?