13 Replies Latest reply on Feb 15, 2013 1:49 PM by philmodjunk

    Go to Layout by Calc with Global Variable

    MelJackson

      Title

      Go to Layout by Calc with Global Variable

      Post

           This one has me scratching the 'ol noggin!...

           Set Variable [$$return_layout; Value:"Customers"]

           Go to Layout [$$return_layout]

           This does NOT work in a script.

           Go to Layout ["Customers"(customers)]  DOES work (of course)

           What am I missing.  Seems pretty straight forward to me!

           Thanks,
           Mel

        • 1. Re: Go to Layout by Calc with Global Variable
          philmodjunk

               Make sure that the variable name in Set Variable and Go to Layout is spelled exactly the same in both places.

               Make sure that the "layout name by calculation" option was used, not "go to layout number by calculation" in the go to layout step.

               And make sure that you do not have an OnLayoutExit trigger controlled script modifying the value of your global variable as it will pop up and modify the value before the go to layout step executes.

          • 2. Re: Go to Layout by Calc with Global Variable
            MelJackson

                 After more experimentation I've found that the global variable works fine when storing the layout NUMBER but the go to layout by name has got me wondering if I'm the worlds only brain donor?

            • 3. Re: Go to Layout by Calc with Global Variable
              philmodjunk

                   Fortunately, your donation has not yet been accepted. wink

                   After all, you did think to ask for help when you couldn't see what was wrong...

              • 4. Re: Go to Layout by Calc with Global Variable
                MelJackson

                     Thanks for the reply PhilModJunk.

                     I'm setting the var with get ( layoutname ) so no chance of typo's.

                     I DO however have an exit script for the layouts.  The strange thing is that the go to layout($$VAR) doesn't even trigger the script.  I guess because it doesn't actually attempt to change layouts. (using script debugger).
                     I've also checked to be sure there is no leading or trailing white space in the layout name but of course how could there be a difference when I'm getting the name from the system?

                • 5. Re: Go to Layout by Calc with Global Variable
                  philmodjunk
                       

                            I'm setting the var with get ( layoutname ) so no chance of typo's.

                       I suggested checking for typos in the name of the Variable, not the name of the layout.

                       What values do you see in the data viewer for your global variable?

                       Here's a file I set when working with this exact concept. Maybe comparing it to yours will reveal a clue: https://dl.dropbox.com/u/78737945/Back%20ExampleCorrected.fmp12

                  • 6. Re: Go to Layout by Calc with Global Variable
                    MelJackson

                         They say a picture is worth a thousand words so a video has to be worth a little more.  Here's a short screen cap of what's going on.

                    http://www.screencast.com/t/ImuzeCBhAvvu

                    • 7. Re: Go to Layout by Calc with Global Variable
                      philmodjunk

                           Are you SURE that the go to layout step isn't set to use the go to layout number by calculation?

                           You can't tell the difference just by looking at the script in the script debugger or in Manage | Scripts.

                           Go to layout number by calculation would be consistant with the error code that you are getting in the debugger.

                      • 8. Re: Go to Layout by Calc with Global Variable
                        MelJackson

                             Absotively, posolutely!!  200% sure I'm using the NAME not the NUMBER.  I've looked at that aspect probably 20 times just to make sure I'm not having a senior moment!! :)

                        • 9. Re: Go to Layout by Calc with Global Variable
                          MelJackson

                               I should add that I found this doesn't happen to ALL layouts.  There are some layouts that I can use in the script and they work perfectly fine.  But there are others that perform as you see in the video.  I've been looking at them for HOURS and can't see any difference between them!!

                          • 10. Re: Go to Layout by Calc with Global Variable
                            philmodjunk

                                 The error code was the only new info I could see in the video. (My office machine does not have speakers so it was "silent movie" experience.)

                                 I realize that what you are doing is a test, but if the same script is being used to go to a different layout and then return, you don't need all these steps and the variable (which, by the way is not a global variable).

                                 Go to Layout [original layout]

                                  can return you to the layout that was current when the script was performed.

                                 As long as the variable is set and then referenced in the same script, it doesn't have to be a global variable, but global variables require two $$ instead of one in their names.

                                 Two more things you can try:

                                 Recover the file and test the recovered copy. Maybe there's an issue with your file.

                                 Upload your file to a file sharing site such as Drop Box and post the download link here so that I can download the file and take a closer look at it.

                            • 11. Re: Go to Layout by Calc with Global Variable
                              MelJackson

                                   I've been a DropBox member for many moons.  How do I share a folder with you.  I don't see a "PM" feature on this forum.

                              • 12. Re: Go to Layout by Calc with Global Variable
                                philmodjunk

                                     Click the multi colored folder that reads "Caulkins Consulting". Then chose the send a private message option.

                                     You do know how to get the download link to a file in your drop box to send to someone don't you? (There's really no need to share a folder just post the link.)

                                • 13. Re: Go to Layout by Calc with Global Variable
                                  philmodjunk

                                       My tests indicate that your file, specifically the customer layout is damaged.

                                       The script worked perfectly on any of the several layouts that I tested except when performing the script from the customer layout.

                                       I then ran a recover on the file and tested the script in the recovered copy (no problems were reported by the recover process).

                                       I was able to get the script to work correctly from the customer layout in the recovered copy of the file.

                                       Things to keep in mind about Recover:

                                       While Recover almost always detects and fully corrects any problems with your file...

                                         
                                  1.           The recovered copy may behave differently even if recover reports "no problems found".
                                  2.      
                                  3.           Recover does not detect all problems
                                  4.      
                                  5.           Recover doesn't always fix all problems correctly
                                  6.      
                                  7.           Best Practice is to never put a recovered copy back into regular use or development. Instead, replace the damaged file with an undamaged back up copy if this is at all possible. You may have to save a clone of the back up copy and import all data from your recovered copy to get a working copy with the most up to date information possible.

                                        

                                       And here's a knowledgebase article that you may find useful: What to do when your file is corrupt (KB5421).