8 Replies Latest reply on Nov 8, 2016 3:39 PM by philmodjunk

    Go to Layout working in a weird fashion

    goutam

      I have a filemaker file which three privilege sets, I am currently developing on my system in Filemaker PRo Advanced 15.

       

      I have a script On fileMaker Open which checks the privilege Set of the user and takes them to the corresponding layout.

       

      When I am testing stuff and login with the different users, the go to layout works perfectly sometimes, but sometimes, it does not take them to the specified layout but takes the user to the layout which the user had opened before closing the application.

       

      It works at times and it does not the other times. What should I do to fix this?

        • 1. Re: Go to Layout working in a weird fashion
          philmodjunk

          There are a number of possible factors from an incorrectly designed script to script triggers being tripped upon exit or entry to the layout. If you have advanced, enable the script debugger and test. You can open a file with a limited access password and still use the debugger if you then enter the full access password when the debugger asks you for it.

           

          Without Advanced, you can put show custom dialogs in places in your script, such as just after the go to layout step to see if the script actually took you to the layout you expected before a possible other script performed by a script trigger might take the user to a different layout.

           

          Nearly every script trigger in FileMaker might be tripped by a layout change depending on the current focus on a given layout before the change takes place.

           

          If you are using one of the "by calculation options" of go to layout, it may be that your calculation does not always evaluate to the actual name or number of a layout.

          • 2. Re: Go to Layout working in a weird fashion
            goutam

            I tried debugging it. As soon as I entered the password, there were two scripts in the call stack, the first one was the OnFileMakerOpen and the second one was the script that is taking the users to the wrong layout. Now I am not sure why the second script came to the call stack. How do I track this?

            • 3. Re: Go to Layout working in a weird fashion
              philmodjunk

              Sounds like your first script is tripping a script trigger.

              The name of the script trigger being tripped should appear in the top of the script debugger.

              • 4. Re: Go to Layout working in a weird fashion
                coherentkris

                Use the script debugger in Fm Adv and step thru the scripts one step at a time

                • 5. Re: Go to Layout working in a weird fashion
                  goutam

                  coherentkris philmodjunk

                   

                  I am still not able to find the additional scripts that are getting executed in addition to the OnFilemakerOpen script when I open filemaker. I think this can be replicated when you open some other layout and close it and open the filemaker again. The file can be downloaded using the link

                   

                  full access username: csd

                  password: csd

                   

                  username: student

                  password: student

                   

                  When we login as the user, the layout "Student - Approved hours" will open

                  https://drive.google.com/open?id=0B8v_JQiDHFFZQWl0Y1lUWUNoM1k

                  • 6. Re: Go to Layout working in a weird fashion
                    philmodjunk

                    As I posted previously, the name of the responsible trigger is shown in the top of the debugger window when the script it performed is executing.

                     

                    You have an OnFirstWindowOpen trigger that performs a script each time that the file is opened.

                    You also have an OnLayoutEnter Trigger on your "admin" layout. Since your file always opens to the admin layout, both triggers are tripped in the sequence of OnFirstWindowOpen, then OnLayoutEnter. So the first script takes you to the student layout only for the OnLayoutEnter triggered script to bring you back to the admin layout.

                     

                    In File Options, specify some other layout as the initial layout and you should then avoid this issue.

                    FileOptions.png

                    • 7. Re: Go to Layout working in a weird fashion
                      goutam

                      Sorry, that did not work for me.

                       

                      The second script that is being tripped is not always the OnLayoutEnter, the layout on OnLayoutEnter is not being opened.

                       

                      Step1: I logged in as a Student and entered the "Student - Approved hours" layout

                      Step2: I closed the filemaker file.

                      Step3: I opened the same file and logged in using the adminstrator credentials, On the script debugger, I saw the OnFileMakerOpen and the On Enter layout of the layout that was opened in the last session.

                       

                      I am not sure why that was opened.

                       

                      PS: How do I use switch layout if I want different layouts opening for different user accounts.

                      • 8. Re: Go to Layout working in a weird fashion
                        philmodjunk

                        You are specifying a layout from which to execute your script without tripping the extra trigger. This can be the same layout in all cases. It's just to make sure that the OnLayoutEnter trigger is not tripped AFTER the OnFirstWindowOpenTrigger.

                         

                        Try the attached file. I used Manage | Layouts to look for a layout that does not have a script trigger and specified in in File Options. That's all it took to keep the OnLayoutEnter trigger from being tripped.