8 Replies Latest reply on Mar 11, 2014 11:55 AM by AbdoulBaldé

    Script triggers issue

    AbdoulBaldé

      Title

      Script triggers issue

      Post

           Hi, 

           On my Layout, I have a pop up menu where user can select a Room #. The values are the list of Rooms available for each floor level. 

           Once the room has been selected, user can then select combinations for the selected Room to view details (Lenght,...)

           Ex:

           - Layout is based on Levels

           - User selects Floor 2 then he can select Room 210 or 220 or 230 (All rooms at Floor 1) => This is the POP UP MENU

           - Then user has to select combination A  or B or C or AB or AC or BC or ABC ==> All combinations are 1 row portals (Displayed as buttons with a conditional formatting formula) 

           I am trying to create a script which will automatically act as if user had clicked on the first combination "A" each time he selects a room from the Pop up Menu. 

            

      My script: 

      Allow user abort [Off]

      perform script (THE SCRIPT RUN WHEN BUTTON IS CLICKED)

            

           I tried to use the following script trigger  "On object Modify" but the script only works 1 out of 2 times Meaning that: 

            

           1- User selects Room 210 from pop up menu

           > Script works 210 A is selected automatically as if user selected 210 then clicked on combination "A"

           2- User selects Room 220 

           > Script does not work ==> Nothing is selected  and user has to click on a a button

           3- User selects Room 230 

           > Script works

            

           Could you please advise on how to fix this bug?

            

           Thanks, 

           Regards. 

            

      Capture_d%E2%80%99%C3%A9cran_2014-03-07_%C3%A0_4.26.10_PM.png

        • 1. Re: Script triggers issue
          philmodjunk

               It might help to see the actual script that is performed when a button in the portal is clicked.

               Without that information, best guess is that records need to be committed before the user selects a new value from the pop up. You can test that idea by clicking a blank area of the layout before making a new selection from the pop up. If that fixes this issue, you can add a commit records step to your script.

          • 2. Re: Script triggers issue
            AbdoulBaldé

                 Please find attached the screenshot of the script. It is a bit difficult to understand the script and this is why I  wanted to avoid it but to explain briefly:

                 Each combination has a number associated. 

                 The link between Rooms table & Attributes table is made by both:

                 SalleID_ns and Combination ID.

                 The script places the Number associated with the Combination ID into the Table on which my Layout is based. The list is then re-ordered. 

                 The re-ordred list and the Room number allow to display the Attributes for this particular combination. 

                 The script also allows us to display a message when combination is not valid/ does not exist. 

                  

                  

            • 3. Re: Script triggers issue
              philmodjunk

                   This is not the entire script. You have a script that is performed by the last line of your script. What does it do?

                   Did you try manually committing records between each selection from the pop up? Did it make any difference? (I see the commit records step in this script, but it's not the last step in your script so committing records as the last step in your script might make a difference here.)

              • 4. Re: Script triggers issue
                AbdoulBaldé

                     Hi, 

                     I am not sure I follow "Manually committing records?". 

                This is not the entire script. You have a script that is performed by the last line of your script. What does it do?

                     > The script only reorders the umber associated with each combination.

                     This way if users clicks on Room 210 then selects A then B or B then A it will display the same details Room 210 A,B. 

                     I have changed my script to be 

                My script: 

                Allow user abort [Off]

                Go to Object [1st Combination] 

                perform script (THE SCRIPT RUN WHEN BUTTON IS CLICKED)

                Commit records

                     When using the OnObjectExit script trigger it works. My only issue is that I have to click outside of the pop up menu (On the IPAD with FileMaker Go 12) to close it. 
                      
                     Do you happen to know a workaround for this?
                      
                     Thanks. 
                • 5. Re: Script triggers issue
                  philmodjunk
                       

                            I am not sure I follow "Manually committing records?".

                       Without that information, best guess is that records need to be committed before the user selects a new value from the pop up. You can test that idea by clicking a blank area of the layout before making a new selection from the pop up.

                       

                            The script only reorders the umber associated with each combination.

                       It might still be helpful to see that script.

                       OnObjectModify is the trigger to use with a popup menu and I still cannot see enough detail to see a reason why it would not work consistently for you here.

                        

                  • 6. Re: Script triggers issue
                    AbdoulBaldé

                         Please find attached a screenshot of the second script performed. 

                         I really don't see why the script does not work. It seems as if only 1 every 2 "modifications" are considering "script triggers". 

                          

                    • 7. Re: Script triggers issue
                      philmodjunk

                           I will note that when you use the OnObjectExit trigger and click outside the field to trip the trigger, you are both exiting the field and committing the record with your mouse click. But I see a commit records step at the end of this script--which is what I did not expect to see here and figured that you needed to add, so I am not sure either why it would only work every other time without investing much more time than I have in trying to run this situation down.

                      • 8. Re: Script triggers issue
                        AbdoulBaldé

                             Hi, 

                              

                             Thanks for your many advices. I am not sure also why the script doesn't work all the time. I will try to see if I can re-arrange the Layout to avoid this.