8 Replies Latest reply on Oct 20, 2015 2:28 PM by dtcgnet

    How do you find what is triggering a script?

    rtolliver

      I have a layout that has 3 separate find scripts that identify characteristic for lumber, Specie,Thickness, and Length.

      My question is for the Length script, somehow another script is executing if the found count is zero.

       

      The other script is called

          UBD Board Viewing

           Set Variable[$ID; Value:T07Inventory::BoardNo]

           Go to Layout ["RetailView Form" (T07Inventory)]

           Enter Find Mode []

           Set Field [T07Inventory::BoardNo; $ID]

           Perform Find []

      This script work fine but it should not be running as part of the Length script.

       

      Can anyone tell me what I need to do to find out what is causing the UBD Board Viewing script to run?

        • 1. Re: How do you find what is triggering a script?
          bigtom

          Are you using FMPA?

           

          I would use script debugger to find out when the script is running exactly. You may have a trigger on a layout or a field that is modified by the length script.

           

          Aside from that the Database Design Report should have some info as well.

          • 2. Re: How do you find what is triggering a script?
            dtcgnet

            You're executing a Go to Layout if your FoundCount is 0. Do you have an "OnLayoutExit" or "OnLayoutEnter" script running?

            • 3. Re: How do you find what is triggering a script?
              rtolliver

              I am using FMPA.

               

              I used script debugger to find out that the UBD Board Viewing script was being executed.  The problem is, script debugger didn't show what triggered the script.

               

              dtcgnet:

              I do have "OnLayoutEnter" to run a script for re sizing the Layout window ONLY

              • 4. Re: How do you find what is triggering a script?
                dtcgnet

                If you've got FMPA, pull a DDR. Search for UBD Board Viewing. That will help you find all occurrences of the script, and you'll be able to determine what is calling it.

                • 5. Re: How do you find what is triggering a script?
                  rtolliver

                  I've found the object that triggers "UBD Board Viewing", it's a field "Board No." and when a user clicks on it it triggers "UBD Board Viewing", it is not suppose to be triggered when returning or entering the layout. The "Board No" field has the Script Trigger: OnObjectEnter;UBD Board Viewing

                   

                  I still don't see what is triggering "UBD Board Viewing", none of the search scripts that execute do anything with the "Board No" field.

                  • 6. Re: How do you find what is triggering a script?
                    tweller860

                    Is the "Board No" field the first field in the tab order of the layout? When the user is returned to the layout in question, the focus may be going to that field without the user actually having to click into it manually.

                     

                    Hope this helps,


                    Regards,


                    TW

                    • 7. Re: How do you find what is triggering a script?
                      dtcgnet

                      The script you posted first...which layout is it being run from? At the end, if your found count is zero, you're going to , RetailView List_Find. That tells me you may be running the script from RetailView List. When you don't find what you're looking for, you're going to "RetailView List_Find". The OnLayoutEnter script would run after the layout is loaded. You should see that script run and complete BEFORE "UBD Board Viewing" runs. Does it? Does the OnLayoutEnter script call any other initialization scripts? Does it set any variables? Does it have any "Go to Field" steps?

                      • 8. Re: How do you find what is triggering a script?
                        dtcgnet

                        I believe I know what's happening.

                         

                        On your layout, I suspect "BoardNo" is the first thing in your tab order, as Todd guessed. As soon as your Get ( FoundCount ) is empty, your script enters find mode. As soon as that happens, the first object in your tab order automatically gains focus. When an object gains focus, "OnObjectEnter" triggers fire. That's probably when the "UBD Board Viewing" script is running.

                         

                        See the attached screen shot. Notice how I've clicked both boxes for "Enable in:"? I created a simple layout with just one field, set to fire a script OnObjectEnter. When I enter Find mode with the trigger enabled in Find mode...the script triggers. Unclick the "Find" option, then see if your script quits firing. I suspect that it will.

                         

                        Trigger.tiff

                         

                        From FileMaker:

                        OnObjectEnter
                        Triggers a script to run when a layout object becomes active as a result of the following:

                        • a user tabs to the object

                        • a user clicks the object

                        • a script step causes an object to be entered--The

                        • a user moves between repetitions in a repeating field