9 Replies Latest reply on May 28, 2013 7:53 AM by SteveMartino

    Tab Panels--selecting via script.



      Tab Panels--selecting via script.


           Hello forum, I have a question regarding tab panels on a layout.

           I have 2 types of customers--residential, and commercial.  I currently have them on one layout.

           There are about 20 specific fields related to both types, and an additional 10 different fields related to each specific type.

           What I was wondering was, can I create a 2 tab panel  on the layout that will contain just those 10 different fields, and have, say as I'm scrolling through the records, the first panel show when it's a residential customer, and the second show when its a commercial customer?

           Or would I be better off just showing them on 2 different layouts?

           Some screen shot....

           Any help or guidance is always appreciated




        • 1. Re: Tab Panels--selecting via script.

               This is an interesting question. And I just tried it out and it turns out you can do this.


               You can name every tab. If you select the tab and you look under "Position" in the Inspector the first thing you'll see is "Name". Right above "Tooltip".

               If you name every tab you can then use the "GoToObject" scriptstep to go to that object.

               In order to see the correct tab when you select a value I made this script:


               The Commit Records / Request commits the type field. Then the type can be cheked and the appropriate tab can be shown.

               I set this script on the Type field as a script trigger on the OnObjectModify Event. So as soon as you click either residential or commercial this script is performed.

               Then on the layout (in "Layout" - "Layout Setup") under script triggers I set the same script on the OnRecordLoad event. That way the script is also performed when you browse trough your records.

               In this case you don't need the Commit Record/Request step, but it doesn't hurt and it prevents you from needing to make two nearly identical scripts.

               Try out my test file and let us know if it works for you.

          • 2. Re: Tab Panels--selecting via script.

                  I created a sample too then DaSaint beat me too it.  Just a couple of suggestion that you may want to add to his sample.  You can also add a script trigger to the layout onRecordLoad then run the script so it will automatically select the correct tab when you open a record.  Also  focus is left on the tab, so you may want to add a go to field (title or last name or any field you want to be the default field when the record loads ) after the ifs statements.

                 I didn't download his sample, this suggestions were based on what he had posted.

            • 3. Re: Tab Panels--selecting via script.

                   DaSaint--Thanks!! It worked perfectly.

                   S Chamblee, Thanks also.  I added your suggestion.

                   I really want to ask why you 2 are in the forum on a Saturday, but then again you could ask me why I'm tweaking my database on a Saturday.

                   Thanks again, greatly appreciated


              • 4. Re: Tab Panels--selecting via script.

                     Hey! What are you saying? Are you calling me a nerd?  cheeky

                     It's raining here where I am, so not much to do outside  :)

                     And databases for me are fun, not only work.

                     See ya!

                • 5. Re: Tab Panels--selecting via script.

                       LOL....I was saying........were all on the computer....why do anything else :)

                  • 7. Re: Tab Panels--selecting via script.

                         Thanks again, both, it really works great.  Now I was hoping to expand on this--if possible with some conditional formatting.  Using the previous script and screen shots, I was wondering if there was a way to hide fields that I don't want information entered into. 

                         For example when the trigger fires for "Commercial" type,could it be possible to 'gray out' or hide with an object (box) all the fields in the Heat Tab.  And the when the opposite is true--when the trigger fires for "Heat" type, it would also gray out all the fields in the Commercial Tab.

                         I remember reading on the forum something about using either conditional formatting, or using a box as an 'object', but cant seem to find it.

                         Also note the Heat & Commercial tabs are not portals.

                         Or......would it be better to have 2 layouts, Used only for data entry--one for Commercial Data entry & one for Heat Data entry, allowing the user (me) to only create new records via scripting.


                         Tweaking away.........


                    • 8. Re: Tab Panels--selecting via script.

                           Here is a demo file illustrating a number of ways to make an object appear/disappear on a layout: https://www.dropbox.com/s/8levaz6deiyzjr8/LayoutObjectVisibilityControlDemo.fp7


                                Also note the Heat & Commercial tabs are not portals.

                           But keep in mind that the fields on those tabs can be placed within a portal as a way to control visibility.

                      • 9. Re: Tab Panels--selecting via script.

                             Good stuff Phi-thanks.  I actually got it to do what you recommended in the tab section.  I was trying to figure out how to get that little "handle" to disappear and came across this:  Thanks again.......and again....Steve.

                             Oops.....didnt come thru.  Try again.  http://sixfriedrice.com/wp/tab-controls-without-the-tabs/