8 Replies Latest reply on Apr 4, 2011 8:36 AM by philmodjunk

    go to layout

    BulbulMajumder

      Title

      go to layout

      Post

      Using script "go to layout" I can go to a certain layout. Now if I can want to go back to the previous layout, what should I do in scripting? Consider that I don't know the name of the previous layout. I need to use the same script to move back and forth between several layout, as we can switch among defferent web pages during web browsing clicking only on back and forward arrow beside the address bar.

        • 1. Re: go to layout
          RickWhitelaw

          "Consider that I don't know the name of the previous layout."

          Why would you not know the name? You select it from the list.

          • 2. Re: go to layout
            BulbulMajumder

            If the situation comes like where numebr of layouts exceeds hundreds, then it will be too difficult to recall the layout name where I was previously even looking through the list.

            This is where I need to have some scripts which will be able to store the immediate previous layout name in local variable which can be recalled along with "go to layout" script.

            Please help me.

            • 3. Re: go to layout
              RickWhitelaw

              You only have to find the Layout Name once! That's when you're writing the script. I suggest you simply do it. It would be unusual to have hundreds of layouts in one file.

              • 4. Re: go to layout
                Kays

                heyy bulbul,

                i think whatcha doin is very difficutl to put but u could start with :

                           set variable ( $var; get ( layoutName))

                 

                K|Z

                • 5. Re: go to layout
                  james.gould

                  As Kays Khelifa suggests I would use a variable to store the name of the previous layout, however I would use a global variable - which means it will still be stored after that script finishes - adding some flexibility as other scripts could use it.

                  Set Variable[ $$BACK ; Get ( LayoutName ) ]

                  Go to Layout [ Layout2 ]

                  ----

                  The Get ( LayoutName ) function will store the name of the layout you're on before going to the new layout... When you want to go back use the Go to Layout script step again but this time choose "Layout Name by Calculation" in the calculation box all you need to enter is $$BACK since it is storing the name of the layout you were on.

                  • 6. Re: go to layout
                    Kays

                    exactly,

                    but the problem here is : when u do "go to layout ($$BACK)" you need to store the current layout too,

                    so here is what you need to :

                    (

                    set variable ( $var; get (layoutName))

                    go to layout ($$BACK)

                    set variable($$BACK; $var)

                    )

                    so everytime leave a layout, you the layoutName stored in $$BACK, and you wont loose the layoutName you left.

                     

                    K|Z

                    • 7. Re: go to layout
                      james.gould

                      Good point! After re-reading the original post I notice it says between SEVERAL layouts... But your simple 2 variable work around overcomes the problems pretty nicely.

                      • 8. Re: go to layout
                        philmodjunk

                        Here's a trick that will maintain a full list of every layout to which you have navigated during a given session so that you can retrace your steps at every point if needed:

                        Write this one line script and set up an OnLayoutEnter script trigger on every layout to perform it:

                        Set variable [$$LayoutHistory ; Value List ( get ( LayoutName ) ; $$LayoutHistory ) ]

                        Then this script will let you go back to the previous layout each time you perform it, all the way to the first layout you accessed when you opened the database:

                        Set variable [$Back ; GetValue ( $$LayoutHistory ; 2 ) ]
                        Set Variable [$$LayoutHistory ; RightValues ( $$LayoutHistory ; ValueCount ( $$LayoutHistory ) - 2 ) ]