3 Replies Latest reply on Jun 2, 2013 9:44 AM by philmodjunk

    Script Trigger (OnLayoutEnter) endless loop



      Script Trigger (OnLayoutEnter) endless loop


       I am trying to get a script trigger (OnLayoutEnter) to run the following script. The script runs perfectly when the script trigger is turned off but it goes into an endless loop (you can see this in the call stack on script debugger) and freezes without completing the find if the script trigger is turned on.


        • 1. Re: Script Trigger (OnLayoutEnter) endless loop

               Scripts can trip script triggers just like user interactions with a layout can. I would guess that the first script step, Go To Layout, is tripping your script trigger.

               If OnLayoutEnter is being used to perfom the script and this trigger is being set up for the "PBMCs" layout, why do you need a go to layout step at the beginning of the script? Since you are already on the PBMCs layout, you could remove or disable that script step and it would still work.

               It is also possible that OnRecordLoad or OnModeChange could be tripped by this script--setting up more complex scenarios where you get stuck in an infinite loop.

          • 2. Re: Script Trigger (OnLayoutEnter) endless loop
             Thanks for the feedback! So I tried removing the "Go to Layout" step and this unfortunately doesn't resolve the issue. Do you have any other ideas for how I might fix this? Also, is there any alternative to a script trigger that would essentially perform the same function (display a found set of data when entering a layout)?
            • 3. Re: Script Trigger (OnLayoutEnter) endless loop

                   If the first script step is not the reason for your infinite loop, then some other script trigger on your layout is being tripped and you should investigate further. Go to Layout is the only step in your script that can trip the OnLayoutEnter script trigger directly.

                   If you have Filemaker Advanced, an easy way to do this is to enable the script debugger and then access the layout and watch what scripts pop up in the debugger.

                   If you do not have advanced, the sleuthing is a bit harder, you will need to check for different possible script triggers. Since removing the OnLayoutEnter script trigger seems to prevent this issue, you may have a chain of scripts being triggered where the script you posted trips a different trigger such as OnRecordLoad, OnLayoutExit, OnModeChange, OnObjectEnter and the script it performs then changes layouts and thus trips the OnLayoutEnter trigger.

                   You may want to edit each suspect script to start with a show custom dialog step that displays the name of the script being performed so that you can see what scripts are being performed if you don't have Advanced.