5 Replies Latest reply on Oct 3, 2013 9:39 AM by philmodjunk

    Automatically choosing a Tab



      Automatically choosing a Tab


           I have a series of fields that are divided up into tabs and I am attempting to create a script that automatically activates a tab based on the data in a field called "Status." Four of the five times, it works perfectly: If the Status field contains Patron, Conference Team, Clients, or Product, the script sets the variable properly and passes that variable on to the Go to Object command. But one of them, Partner, flat out ignores me, reverting to the default for that tab group.
           The code is below; I can't for the life of me figure out what is going on. There are no typos or problems with singular/plural designations -- what is so special about the word "Partner" that it would cause this linear progression of logic to fail? (On that note, I tried renaming the tab to "Goofball" and the test for that name; same result.) This is the only time I have used this type of syntax so I don't have enough breadth of experience to sniff out any problems for myself. Any suggestions, I'd be most grateful.
           If [ Details::Details = "PresentationXpert Power Skills Workshop" ]
           Set Variable [ $$Tab; Value:"Workshops" ]
           Else If [ Details::Status = "Partner" ]
           Set Variable [ $$Tab; Value:"Partners" ]
           Else If [ Details::Status = "Patron" ]
           Set Variable [ $$Tab; Value:"Patrons" ]
           Else If [ Details::Status = "Conference Team" ]
           Set Variable [ $$Tab; Value:"Staff" ]
           Else If [ Details::Status = "Client" ]
           Set Variable [ $$Tab; Value:"Clients" ]
           Else If [ Details::Status = "Product" ]
           Set Variable [ $$Tab; Value:"Product" ]
           End If
           Go to Related Record
                Go to Object [ Object Name: $$Tab ]


        • 1. Re: Automatically choosing a Tab

               I would check the text in Details::Status and see if maybe it is "Partners" instead of "Partner". An added space might also be the culprit.

          • 2. Re: Automatically choosing a Tab

                 Thank you very much for the reply. While the singular -> plural relationship is potentially confusing, it is definitely not the cause of the problem (see my Goofball experiment), and your idea to check for spurious spaces was a very good one. Alas, no rogue spaces anywhere.

                 I did create a workaround. As I mentioned, instead of going to the Partners tab, the script takes me to the default tab. So seeing how the other four work fine, I just changed the default tab to be Partners, and now when it fails, it dumps me where I want to be in the first place.

                 Still no idea why it fails, but my bandaid seems to be holding...

            • 3. Re: Automatically choosing a Tab

                   Your "goofball experiment" checked the OBJECT NAME, but as far as I could tell, did not check the text in your FIELD. If the problem lies with the data in the field, changing the object name and specifying the new name in your script will not check that detail.

              • 4. Re: Automatically choosing a Tab

                     For my Goofball experiment, I changed the data in the Status field to Goofball, renamed the Tab to Goofball, and updated lines 3 and 4 in the code above.

                • 5. Re: Automatically choosing a Tab

                       To state what is probably very obvious to you, the same exact text has to appear in three places, the object name box, the quoted text in the if step and in the set variable step. One letter difference in any of those three places will keep this script from working.

                       You might compare your file to this one where I tested some of the concepts covered in this thread: https://dl.dropboxusercontent.com/u/78737945/TabControlTest.fmp12 In the test file, you can click the radio button field to trip a script trigger that performs the test script and it then pops the selected tab to the front.

                       Do you have any script triggers set on either the tab control or fields inside the Partners tab panel? If a script trigger is being tripped by your script, that might explain what you are getting this issue and this will be the case no matter what names you use.

                       You might also try, as a test, creating a brand new layout put a brand new tab control on it with the correct tab panels and object names and see if your script works on that test layout. That could identify an issue with your layout either an interfering script trigger or even corruption of the layout itself.