4 Replies Latest reply on Jul 24, 2012 12:39 AM by LaurenceHarrould

    How to sort portal rows using code?



      How to sort portal rows using code?


      I have a portal which shows people attending a meeting. The master is Meeting and the portal records are MeetingPeople.

      The user manually selects which people will be attending as they register. This means they're recorded in non-alphabetical order.

      I want to provide a button that will resort the portal records when the user clicks the button but otherwise leaves the records in the order in which they were entered.

      I've not used the sort option in the portal setup because that sorts the records every time a new one is entered. This means the records are jumping around as they're entered and this can get confusing.

      I'm using FM Pro 11 and will soon be upgrading to 12.



        • 1. Re: How to sort portal rows using code?


          You have a Name field that is the person name and also you have each records cretion timestamp.

          So Add a script

          sort by Meetingpeople::Name[Asending/Descending]

          For ist time if you want to sort by Name and for 2nd it will be by creation time then make a if....else script and in else part just add this

          sort by Meetingpeople::CreatinTimestamp[Asending/Descending]




          • 2. Re: How to sort portal rows using code?

            Thanks Atauf. That's what I had tried.


            Here's the script I have.

            Go to Portal Row [Select; First]

            Sort Records [Restore; No dialog]  (The sort was - MeetingPeople::Person_FullName)

            Refresh Window []


            But that didn't make any difference

            • 3. Re: How to sort portal rows using code?


              There are two way to do it


              Make two tab(Hidden) named as Port1 and Port2

              In port1 portal setup sort record by its cretaion Timestamp field

              In Port2 portal setup sort record by its MeetingPeople::Person_FullName

              Then create a script such a way that when user click on that SORT button then it will navigate to the Port2 tab.The default tab must be port1.



              The portal showing in that layout is coming form the realtionship.So make a duplicate  relationship with the same fields.

              1>Sort 1st realtionship by its name

              2>Sort others to its creation Timestamp

              Make two hidden tab and in each tab put the related portal from the relationship and Default tab must be the portal sorted by the Creation Timestamp field.

              Run the script having only one step e.g go to object port2 like FIRST way.


              NB:As the tabs are hidden,the user will not get  any info regarding this.

              Hope you will get your solution.


              • 4. Re: How to sort portal rows using code?

                Thanks. That sounds like a good approach. Smile