7 Replies Latest reply on Nov 28, 2016 9:19 PM by Lawrencex

    Sorting Rows in FileMaker 15

    Lawrencex

      Hello Filemaker Pros,

       

      Would appreciate some tips for the following:

       

      I have Fields "A" "B" "C" "D."   Each of those fields contains values, eg:

      Field A=420,  B=220  C=101   D=315.  The values are always at random,

      and changes for each record.

       

      I have to sort these values in Fields: AA, BB, CC, DD in the order of

      smallest to biggest, for the example above, as : AA=101, BB=220,

      C=315  D=420.

       

      I am trying to get a function or a script to organise sorting these

      4 fields to produce the said result, but seem to be a difficult task

      to achieve.

       

      This is somewhat similar to MS Excel functions, Large() and Small ().

       

      Thank you in advance for your hints/tips.

       

      Lawrencex

        • 1. Re: Sorting Rows in FileMaker 15
          keywords

          What is the connection, if any, between the first set of fields (A, B, …) and the second set (AA, BB, …)? Are all eight fields part of a single record?

          Can you please explain your purpose and structure better, as this will help you get more meaningful responses.

          • 2. Re: Sorting Rows in FileMaker 15
            David Moyer

            Hi,

            it seems that if you have four fields that can be compared to each other (sorted - apples to apples), then you should be using a related table to store that data.

            A relationship between your main table and this new data table can be "made to be sorted".  A portal (or even the List function) based on this relationship will be sorted.

            1 of 1 people found this helpful
            • 3. Re: Sorting Rows in FileMaker 15
              taylorsharpe

              If you do much text manipulation, then a plugin like Monkey Bread Software comes in real useful (it has the entire CURL library and other text manipulations).  Here is how I would do it with MBS:

               

              Set Variable [ $A ; Value: Right ( Random ; 3 ) ]

              Set Variable [ $B ; Value: Right ( Random ; 3 ) ]

              Set Variable [ $C ; Value: Right ( Random ; 3 ) ]

              Set Variable [ $D ; Value: Right ( Random ; 3 ) ]

              Set Variable [ $Array ; Value: List ( $A ; $B ; $C ; $D ) ]

              Set Variable [ $ArraySorted ; Value: MBS ( "List.Sort" ; $Array ) ]

              Set Variable [ $AA ; Value: GetValue ( $ArraySorted ; 1 ) ]

              Set Variable [ $BB ; Value: GetValue ( $ArraySorted ; 2 ) ]

              Set Variable [ $CC ; Value: GetValue ( $ArraySorted ; 3 ) ]

              Set Variable [ $DD ; Value: GetValue ( $ArraySorted ; 4 ) ]

               

               

              Or you can write a loop that compares and sorts.

               

              Most of my client servers have MBS on the server and I just run a PSoS since I can't be certain each client machine has MBS on it.

              • 4. Re: Sorting Rows in FileMaker 15
                JackRodges

                Consider using a new table with four records.

                Set nbr field to A

                Set nbr field to B

                Set nbr field to C

                Set nbr field to D

                 

                Sort on number field

                Step through records and set nbr into a field

                 

                This is reuseable and quick and most important, EASY...

                1 of 1 people found this helpful
                • 5. Re: Sorting Rows in FileMaker 15
                  Lawrencex

                  Thank you for your hint.

                  • 6. Re: Sorting Rows in FileMaker 15
                    Lawrencex

                    Hello Taylor

                     

                    Thank you.  It works fine.  Many thanks for tips.

                    • 7. Re: Sorting Rows in FileMaker 15
                      Lawrencex

                      Thank you for the tips.