8 Replies Latest reply on May 15, 2017 7:45 PM by user19752

    Sort Portals

    user28271

      My process for sorting portals is to have a calculation in the lines that uses by a global field so I can change what value will be used for the sort.

       

      This works fine unless the file type isn't the same.  Such as Sort by Date vs Sort my Amount vs Sort by Description.

       

      Before I build multiple portals each with a dedicated sort I thought I would ask if there was a better solution.

        • 1. Re: Sort Portals
          Johan Hedman

          To have sorted portals based on Calculation can never be fast, but are smart. Working with many records will make it a very slow user experience for your users.

           

          The other choice is to have a Tab with a portal on each tab where you have sorted on the different fields. Then when you click on a label you just go to the tab where the portal is sorted on that label.

          Tab 1

          Portal is sorted on first label

          Tab 2

          Portal is sorted on second label

          ....

           

          Then a button on each label going to Go to object

          • 2. Re: Sort Portals
            beverly

            By date could be alpha- & chronological if you calculate your date to this "text" format:

            yyyy-mm-dd // leading 0s

            Amount would need a similar text conversion (padded with leading 0s?) How large is your largest amount?

             

            Sent from miPhone

            • 3. Re: Sort Portals
              beverly

              This is the better option!

               

              Sent from miPhone

              • 4. Re: Sort Portals
                user28271

                This is for a credit card reconciliation module.  So thenmber of lines is less then a hundred but the amount can be large.  Over 10K

                • 5. Re: Sort Portals
                  philmodjunk

                  With the global field method, the trick is to get all values to sort correctly as text. As beverly mentioned for dates.

                   

                  Right ( "00000" & NumberField ; 5 ) will pad integers up to 99999 with leading zeroes so that they sort correctly as text. You'll need to consider trailing zeroes after the decimal as well if the amounts are not integers.

                  • 6. Re: Sort Portals
                    FileKraft

                    you can use an unstored calculation result type text with choose function and add 110000000000 to the numeric field and use getAsNumber to the Date field  like:

                     

                    TheSortFieldTextResultUnstored :=

                     

                    choose ( global _index_sort_field ;

                     

                    GetAsNumber ( TheDateField ) ;

                     

                    110000000000 + TheAmountField )

                     

                    then Set the global _index_sort_field to what needs to be sorted by.

                    • 7. Re: Sort Portals
                      beverly

                      wouldn't be handy to have

                      Sort Records by Field

                      work in Portals (and not just found set or records)?

                      • 8. Re: Sort Portals
                        user19752

                        To sort any range of numbers, you can use 2 unstored calculation fields for number result and text result.

                         

                        number

                        Case ( MiddleWords ( FieldType ( "" ; gSortF ) ; 2 ; 1 ) <> "text" ; Evaluate ( gSortF ) )

                        text

                        Case ( MiddleWords ( FieldType ( "" ; gSortF ) ; 2 ; 1 ) = "text" ; Evaluate ( gSortF ) )

                        then use both in portal sort.

                        1 of 1 people found this helpful