7 Replies Latest reply on Jun 21, 2010 3:06 PM by sksmith2517

    Return to Previous Screen/Layout

    eqitec

      Title

      Return to Previous Screen/Layout

      Post

      Is there any way to script a button which when clicked returns the user to the screen/layout they were on immediately before the current screen?

        • 1. Re: Return to Previous Screen/Layout
          philmodjunk
            

          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.

          • 2. Re: Return to Previous Screen/Layout
            eqitec
              

            I don't see that Get (layout name) in my version of FileMaker. In which version was it introduced? Thanks.

             

            • 3. Re: Return to Previous Screen/Layout
              LaRetta_1
                

              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?

              • 4. Re: Return to Previous Screen/Layout
                philmodjunk
                  

                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.

                 

                • 5. Re: Return to Previous Screen/Layout
                  LaRetta_1
                    

                  "that was current at the start of a script's execution."

                   

                  Correct, Phil, and that's why I said, "If you START by switching layouts."  I read the request as wanting the ability to EASILY return to the exact layout where the script is fired from but specify the layout dynamically.  My misinterpretation, I guess.  I know it doesn't work in a different script.
                  • 6. Re: Return to Previous Screen/Layout
                    philmodjunk
                      

                    Fair enough and if you're right and I'm wrong, the original poster can let us know. :smileywink:

                     

                    • 7. Re: Return to Previous Screen/Layout
                      sksmith2517

                      18 months later - and it's just what I wanted / needed and it works very nicely.

                      Thanks so much