8 Replies Latest reply on Feb 21, 2013 1:01 PM by obidon

    Startup Script vs Trigger Script

    obidon

      Title

      Startup Script vs Trigger Script

      Post

           I am using FM12 Advanced.  My database has three layouts, one is a list view.  The other layouts two are forms.

           I have created a trigger script which selects one of the two form layouts based on a field criteria in the record. This is triggered using OnLayoutEnter.  During normal operation, this works perfectly well.

           OnWindowOpen triggers my startup script.  The startup script goes to the list view, sorts, goes to first record and exits. I`ve added custom dialogues to confirm the process starts and finishes and I am also runing the debugger.

           My problem is that upon completion of the startup script, the OnLayoutEnter trigger initiates.  This script is not assigned to my list view.  It does not appear to run in the debugger either.  

           I`ve narrowed the problem down by disabling the trigger scripts.  Please help?

        • 1. Re: Startup Script vs Trigger Script
          philmodjunk

               Do you specify a starting layout in File Options? Might that layout be the one with the OnLayoutEnter trigger?

               If you enable the script triggers, but temporarily disable the start up script, is the trigger tripped?

          • 2. Re: Startup Script vs Trigger Script
            obidon

                 Evening Phil

                 No starting layout was specified in the file options. That was my first thought.

                 As suggested, I have disabled the OnWindowOpen & OnWindowClose Scripts. I have set the file option switch to layout on opening `to my list` and enabled the OnLayoutEnter triggers.

                 This works without error.

                  

                 Don

            • 3. Re: Startup Script vs Trigger Script
              philmodjunk

                   Hmmm, by any chance was the layout with the trigger the current layout, the last time this file was closed? (On a network, this would be the last time that the file was closed on a FileMaker Pro host.)

              • 4. Re: Startup Script vs Trigger Script
                obidon

                     I`ve utilised a closeout script, which returned the file to the layout list before closing the file. Again, that was debugged to ensure it was working.

                     The file is hosted , but I am getting the same issue on a local version.

                     These are my startup and trigger scripts along with my layouts

                      

                • 5. Re: Startup Script vs Trigger Script
                  philmodjunk

                       That bottom script looks to me like a script to be performed by the OnRecordLoad trigger instead of OnLayoutEnter unless test type is a global field.

                  • 6. Re: Startup Script vs Trigger Script
                    obidon

                         Hi Phil

                         I have reinstated the startup & closeout scripts and the layout trigger scripts.  Everything seems to be working fine and it appears to be one of those unexplainables....

                         I will follow your advice and utilise the OnRecordLoad Command

                          

                         Many Thanks

                    • 7. Re: Startup Script vs Trigger Script
                      philmodjunk

                           I'm basing that comment on very limited information. My assumption here is that each record specifies one of the two layouts. By using OnRecordLoad instead of OnLayoutEnter, each time you change records, the script can change layouts, if needed to display the record on the specified layout. That may or may not be what you had in mind for this.

                      • 8. Re: Startup Script vs Trigger Script
                        obidon

                             Phil

                             Its a very simple system, with very few user functions.  For example, users can`t scroll through records.  They access records from the list and this locks every thing else out.  

                             In this instance, having weighed the options, I think on record load provides a more robust solution