4 Replies Latest reply on Sep 24, 2010 6:09 PM by miw

    Change sort of a portal

    MikeyG79

      Title

      Change sort of a portal

      Post

      Is it possible to have a script change the sort order of a portal?

        • 1. Re: Change sort of a portal
          philmodjunk
            

          No, but there are ways to fake it.

           

          Layouts that are identical in every way except for the portal's specified sort order is one way. (Buttons to change the sort order simply switch the layout.)

           

          If your portal only displays small numbers of records there are ways to update a "sort" field in all the related records so that the records display in a different order. This approach can get really messy though if you are sharing the database over a network.

           

          Each approach can have singificant draw backs, but if you really want the user to be able to change the portal's sort order...

          • 2. Re: Change sort of a portal
            MikeyG79
               With some custom functions, a script, and few new fields - we can now change the sort order of a portal, and the whole screen doesn't even blink.
            • 3. Re: Change sort of a portal
              a-coder
                

              A portal can be sorted on a field which is a Custom Function and set to recalculate when needed.  The function can change its return value based on your selected method. 

               

              For Example:

                The program we have contains a record for user preferences.  On this record is a field for the column of the portal the user prefers.  The function returns the field that this column refers to.  Clicking on the header of the portal runs a script that changes the value in the preference record, say from column1 to column2.  And presto the portal will now sort on the new value the function is returning.

              • 4. Re: Change sort of a portal
                miw

                Can you show what the script would look like?