1 2 3 Previous Next 33 Replies Latest reply on Jul 20, 2013 8:12 AM by debi

    How to script Get (TriggerTargetTabPanel)

    ithink

      Hi,

      I'm new to posting questions and have a limited knowlege of Filemaker so I ask for your patience.

       

      I have a type field that has 5 type values assigned. I have 2 invisible tab panels within a main tab panel hiding additional fields containing related information to 2 specific type values. I have a script trigger assigned to open either invisible tab 1 or 2 depending upon the type value selected.

       

      I've scripted a button that opens the main tab to reveal the main body of fields, and assigned a script trigger to open the other hidden tab(s) according to their related type value. I have attached this script to the layout script trigger onrecordload. I would like this script to run in onrecordload mode only if a selected tab is opened. Any ideas as to how I can accomplish this?

       

      I've messed around with the Get (TriggerTargetTabPanel) and GetValue function but I'm unsure how to structure the Get (TriggerTargetTabPanel) script so that the value can be extracted in the GetValue function which is triggered to run in the onrecordload mode.

       

      I believe the GetValue script attached to the onrecordload trigger is correct If (Getvalue ("General Entry Button"; 3 (Perform Script [Show Tab 1 or 2] End If

       

      Thanks

       

      I originally posted this in the general discussion but it's probbly more suited for the scripting and calculations. Sorry for my lameness.

        • 1. Re: How to script Get (TriggerTargetTabPanel)
          taylorsharpe

          I'm thinking you mean to do something like this:

           

               If ( GetValue ( Get ( TriggerTargetTabPanel ) ; 1 ) = 3

           

                    Perform Script [ Show Tab 1 or 2 ]

           

               Else

           

                    Exit Script [Result=0]

           

               End If

           

           

          Remember that the first value in the Get ( TriggerTargetTabPanel ) returns the button number.  Remember to have the Exit Script Result set to 0 so that the button you clicked won't take effect assuming that is the behavior you want. 

          • 2. Re: How to script Get (TriggerTargetTabPanel)
            Mike_Mitchell

            If I understand what you're trying to accomplish correctly, you could state it this way:

             

            "When a record loads, I want to select a tab panel based on the value of a field."

             

            If that is correct, then you don't need a second trigger at all. What you would need to do is this:

             

            1) In your Inspector, assign a name to each tab you want the script to navigate to.

            2) Use the Go to Object script step inside an If - Else If script logic to move the focus to the correct tab, like this:

             

            If [ Field = "Value 1" ]

              Go to Object ( "Tab 1" )

            Else If [ Field = "Value 2" ]

              Go to Object ( "Tab 2" )

            End If

             

            That should do what you need.

             

            Mike

            • 3. Re: How to script Get (TriggerTargetTabPanel)
              BruceHerbach

              Hi

               

              This is a good question.  So no lameness here.

               

              In addition to the suggestions above you can add an objectmodify script

              trigger to change the sub tab if the field is changed.  This would run

              when/if the user changed the value of the field.

               

               

               

              Sent from my mobile device... Please excuse typos.

              • 4. Re: How to script Get (TriggerTargetTabPanel)
                Mike_Mitchell

                As a more advanced, more extensible version, you could name your tab objects equal to the value in the field you're testing. Then, you could do this:

                 

                Set Variable [ $objectNames ; LayoutObjectNames ( Get ( FileName ) ; {name of layout} ) ]

                If [ not IsEmpty ( FilterValues ( $objectNames ; Evaluate ( field ))) ]

                     Go to Object ( Evaluate ( field ))

                End If

                 

                This would allow you to add tab objects later if you wanted to without having to change the script.

                 

                Mike

                • 5. Re: How to script Get (TriggerTargetTabPanel)
                  SteveMartino

                  Did you get Mike's method to work.?  I did the same on my DB and attached it to an OnRecordLoad script trigger.

                   

                  Based on field-Customer Type (Residential or Commercial), it selects 3 different panels I would like to show on the layout

                  Untitled.png

                  • 6. Re: How to script Get (TriggerTargetTabPanel)
                    ithink

                    I probably didn't explain what I'm trying to accomplish very well. I have a script that is functioning as the script that is triggered to go the proper tabs based upon the type value. What I'm trying to accomplish is to keep that script from running and opening the main tab exposing the data unless I open the assigned tab to which would then allow the record to record navigation to tirgger the main script.

                     

                    Dan

                    • 7. Re: How to script Get (TriggerTargetTabPanel)
                      ithink

                      I probably didn't explain what I'm trying to accomplish very well. I have a script that is functioning as the script that is triggered to go the proper tabs based upon the type value. What I'm trying to accomplish is to keep that script from running and opening the main tab exposing the data unless I open the assigned tab to which would then allow the record to record navigation to tirgger the main script.

                       

                      Dan

                      • 8. Re: How to script Get (TriggerTargetTabPanel)
                        ithink

                        I probably didn't explain what I'm trying to accomplish very well. I have a script that is functioning as the script that is triggered to go the proper tabs based upon the type value. What I'm trying to accomplish is to keep that script from running and opening the main tab exposing the data unless I open the assigned tab to which would then allow the record to record navigation to tirgger the main script.

                         

                        Dan

                        • 9. Re: How to script Get (TriggerTargetTabPanel)
                          Mike_Mitchell

                          So you have a default tab you don't want to show unless someone clicks on one of the other tabs?

                           

                          This might be a stupid question, but why don't you hide that tab and make one of the others the default?

                          • 10. Re: How to script Get (TriggerTargetTabPanel)
                            ithink

                            Hi Mike,

                             

                            Was out all morning so sorry for the delayed response.

                             

                            I have 2 sets of tabs that are linked together by scripting. Set 1 is holding hidden buttons that are linked to their respective data tabs. Set 2 is the data tabs made up of 4 main tabs with tab 1 showing the main visible data while enclosing an addtional 3 invisible tabs. The data tabs (set 2) default tab is the outer tab which is blank or in other words hiding the data.

                             

                            The secondary tabs default tab is the outer tab and is also blank or in other words hiding the related data to be revealed only when the type value is valid. Tab 2 and 3 of the secondary tabs contain the related info linked to the value of the type field shown in the main tab 1.

                             

                            So in essence I want the default blank tab in tab set 1 and tab set 2 to remain blank when I'm navigating the records unless I click the target button in tab set 1 which opens tab 1 in tab set 2. Only after those tabs are open do I want the onrecordload script to run and open the secondary tabs in tab set 2 revealing their related info.

                             

                            Hope this clarifies my intention.

                            • 11. Re: How to script Get (TriggerTargetTabPanel)
                              ithink

                              I just read my post and thought this can be explained much more simply. The script accomplishing the main task of revealing the related data based upon the type value works fine. I just want the onrecordload script trigger to run only if the button tab 1 and the data tab 1 are open.

                              • 12. Re: How to script Get (TriggerTargetTabPanel)
                                BruceRobertson

                                Have you considered posting an example file demonstrating what you're trying to do?

                                • 13. Re: How to script Get (TriggerTargetTabPanel)
                                  ithink

                                  I created a sample file and I keep getting an error when I try to insert it. I also made a quicktime video and also got an error. How do I accomplish this?

                                   

                                  Thanks

                                  • 14. Re: How to script Get (TriggerTargetTabPanel)
                                    debi

                                    Dan,

                                     

                                    In your other thread, Mike Beargie suggested looking into the GetLayoutObjectAttribute function. That is what you can use to tell you what other tab control is active. It's a bit to digest, but I think it is what you need.

                                     

                                    HTH,

                                     

                                    Debi Rubel
                                    FullCity Consulting

                                    1 2 3 Previous Next