4 Replies Latest reply on Jun 11, 2014 11:02 AM by pinchvalve

    Filter records on a Layout without a Find?

    pinchvalve

      Title

      Filter records on a Layout without a Find?

      Post

           I have an Accounts table that includes three types of accounts:  Lead, Prospects and Customers.  I have a different layout for each type.  When you load the layout, a Find script runs to show only the applicable type of account.  This works well, except whenever you enter the layout it resets to the first record.  

           Users who are looking at one record want to navigate to another layout, then return and be on the same record they left.   Any thoughts on how to do this?  

           One solution is have a separate tables for Leads, Prospects and Customers, but that is more data and more repetition and when an account moves from Lead to Prospect, I have move the record and all related data from one table to another.  Ugh. But maybe that's just the way it's done?

            

            

        • 1. Re: Filter records on a Layout without a Find?
          philmodjunk

               Better take a closer look at your layouts. Simply changing layouts will not "reset to the first record". Do you have several layouts that all specify the same exact name in Layout Setup | Show Records From?

               If that's the case, you have several layouts based on the same "table occurrence"--one of the boxes used to define relationships in Manage | Database | Relationships. A given table occurrence in a given window will have one found set with a specific current record and a current sort order. All layouts you might switch to in that window that are based on that table occurrence will share the same found set, current record and sort order.

               But it's also possible that you are either tripping a script trigger that is changing the current record.

               Or perhaps you are looking at what record is current in a portal. Changing layouts will reset the portal's scroll bar back to the original top of the portal position.

          • 2. Re: Filter records on a Layout without a Find?
            pinchvalve

                 I do have a script trigger upon enter that calls up a script that performs a search for "account type".   

            • 3. Re: Filter records on a Layout without a Find?
              philmodjunk

                   So if you disable that script tirgger controlled script whenever you want to return to this layout--since there would then be no need for performing this find all over again, you wouldn't see the current record change.

                   Here's how I disable script triggers.

                   I set up a global variable, $$TriggersOff and set it to True whenever I need to disable all trigger performed scripts.

                   I enclose all trigger performed scripts inside an If block like this:

                   If [ Not $$TriggersOff ]

                      Put rest of script here

                   End IF

                   So a script like this:

                   Set Variable [$$TriggersOff ; value: True ]
                   Go to Layout
                   Set Variable [$$TriggersOff ; value: False ]

                   then allows me to return to the layout without performing an uneeded find all over gain and my current record should stay put.

              • 4. Re: Filter records on a Layout without a Find?
                pinchvalve

                     Genius!  That is exactly what I was looking for.  I will try that out.  Thank you.