1 2 Previous Next 22 Replies Latest reply on Jun 28, 2016 11:57 PM by tays01s

    Get ( TriggerCurrentPanel )


      If I have tabs but on 1 of them is a slide panel, all with object names, is it the tab or slide panel that will be considered the CurrentPanel?

        • 1. Re: Get ( TriggerCurrentPanel )

          Whichever panel type object caused the event to fire.

          The function returns 0 unless triggered by the onPanelSwitch event.


          Returns the index and the object name of the current tab panel or slide panel (the panel to be switched from) when the OnPanelSwitch script trigger is activated

          • 2. Re: Get ( TriggerCurrentPanel )

            If everything has an object name, then do you really need to know the current panel? Maybe you do. Maybe not. What are you trying to do?

            • 3. Re: Get ( TriggerCurrentPanel )

              Desired action: Trigger a Custom Dialogue if certain fields aren't filled when attempting to leave the tab. The Dialgue permits the user to override this and still leave the tab.


              Problem: When moving from the new tab, I again trigger the script. It appears that even they Inspector indicates I'm on the target object when I set the OnTargetPanel script trigger, it actually puts the trigger on the full set of tabs. The 'Target tab' also has 2 slideover panels on top of it which I've named. I tried instead putting the script trigger on these to avoid it attaching to all tabs, but the trigger fails to work; seems to just get ignored. Script below:



              Commit Records/Requests [ No dialog ]

              If [ ( IsEmpty(Calc_n::cm) or IsEmpty(Calc_n::kg) )]

              Show Custom Dialog [ Title: "Complete Calc info"; Message: "You should complete critical fields before leaving this tab:"&¶ & If(IsEmpty(Calc::cm);"cm";"") &¶ &
              If(IsEmpty(Calc::kg);"kg";""); Default Button: “Complete”, Commit: “Yes”; Button 2: “Switch tab”, Commit: “Yes” ]

              Exit Script [ Result: Get ( LastMessageChoice ) = 2 ]

              End If

              If [ GetValue ( Get ( TriggerCurrentPanel );2 ) ="calcs_min" and ( IsEmpty(Calc_n::cm) or IsEmpty(Calc_n::kg) )]

              End If


              Obviously I change the object name [eg. calcs_min] depending on the object panel I was trying to trigger from.

              • 4. Re: Get ( TriggerCurrentPanel )

                Any chance you could post a sample file of it?

                • 5. Re: Get ( TriggerCurrentPanel )

                  on panel switch check the data and return false with exit condition to prevent changing tabs if the data is not filled in

                  • 6. Re: Get ( TriggerCurrentPanel )

                    File: It's hugely complicated and confidential, so sorry can't post it.


                    Aim: As mentioned I want to permit users a choice: Complete (data) or Switch Tab. This means that if they click Complete, it's fine as is. But if they 'Switch Tab', it's fine in permitting this, but then when they next change tab they are again confronted with the Dialogue. I want the dialogue only to appear if they are trying to leave 'Calcs' and data is missing.

                    • 7. Re: Get ( TriggerCurrentPanel )

                      You do understand that your script is not correctly constructed, right?


                      For instance; the last IF does nothing at all.

                      However; you never get there.

                      The Exit Script statement always happens, and the result is False when the user chooses "Yes" and True when the user chooses "Switch Tab".

                      • 8. Re: Get ( TriggerCurrentPanel )

                        "File: It's hugely complicated and confidential, so sorry can't post it."


                        But that doesn't prevent you from building an example file so we can actually see what you are trying to do; and then modify your example file and say, "is this what you had in mind?"

                        • 9. Re: Get ( TriggerCurrentPanel )

                          Good point, I should do that sooner. Self-evidently, I've not used this combination of scripting functions so I'm rather lost. Example file attached.


                          Account = Admin

                          pw          = 1


                          Logic I'd like to follow:

                          1. If cm ± kg fields are empty when switching away from panel1 I want Custom dialogue shown. [Currently the script fails to work even at this first stage].

                          2. If the user chooses "Complete" I want to stay on 'panel1'.

                          3. If the user chooses "Switch tab" the switch goes ahead (something that should happen anyway if both 'cm' and 'kg' are not empty.

                          • 10. Re: Get ( TriggerCurrentPanel )

                            I'm getting a message that says "The access privileges in this file have been damaged or possibly tampered with. Please contact FileMaker Technical Support if the problem cannot be resolved.


                            Can you adjust it and reupload it?

                            • 11. Re: Get ( TriggerCurrentPanel )

                              Thanks. I've re-uploaded the file with:

                              Account = Admin

                              pw          = 1

                              I've tested it at this end.

                              • 12. Re: Get ( TriggerCurrentPanel )

                                Have you read Help for the get( triggerCurrentPanel ) function?

                                It doesn't look like it.

                                The function returns a list. You only check for object name. Therefore your script will always fail.

                                Attached is an edited version which works.


                                FileMaker Pro 15 Help

                                • 13. Re: Get ( TriggerCurrentPanel )

                                  Bruce before I looked at your script I found this to work:


                                  Commit Records/Requests [ No dialog ]

                                  If [ GetValue (Get(TriggerCurrentPanel);2)="tab_calcs" and ( IsEmpty(Calc_n::cm) or IsEmpty(Calc_n::kg) )]

                                  Show Custom Dialog [ Title: "Complete Calc info"; Message: "You should complete critical fields before leaving this tab:"&¶ & If(IsEmpty(Calc_n::cm);"cm";"") &¶ &
                                  If(IsEmpty(Calc_n::kg);"kg";""); Default Button: “Complete”, Commit: “Yes”; Button 2: “Switch tab”, Commit: “Yes” ]

                                  If [ Get ( LastMessageChoice ) = 1 ]

                                  Exit Script [ Result: False ]

                                  End If

                                  End If


                                  May I check:

                                  1. Your 'Set variable' and 'Else' don't seem to have a function; are these really there in case you build a more complex script?


                                  2. Does my 'GetValue' serve just as well as your 'PatternCount' or, again, does your version have an advantage in more complex situations?


                                  3. Exit Script: From the function reference is appears you can put a value/calc as the result. So I think I understand how True/False cause exit depending on the previous 'If', but can you not use a value/calc directly without 'IF', eg. using 'Get(LastMessageChoice)=1' within Exit??

                                  • 14. Re: Get ( TriggerCurrentPanel )

                                    1. Using the variable allowed me to watch the actual trigger in the data viewer while running the script. I would normally have changed the IF statement to use this variable.

                                    2. GetValue does work, yes.

                                    3. Lots of problems in this statement. True/False do not CAUSE the exit. With your proposed change the script WILL exit.

                                    They are results passed by the script. It isn't clear whether you understand that get(LastMessageChoice)=1 is a boolean statement. And it would NOT work for your script. Because if the user had clicked button 1, then get(lastMessageChoice)=1 would evaluate as True. Therefore your script would fail.

                                    To cancel the attempted panel switch you need to pass a result of False. So, with your suggested mod, you could instead use get(LastMessageChoice)=2. This would evaluate as True if the user did in fact click button 2; and as False if the user chose button 1. I think it is clearer to explicitly declare the intended result.

                                    See help for OnPanelSwitch

                                    FileMaker Pro 15 Help

                                    1 2 Previous Next