2 Replies Latest reply: Oct 8, 2015 7:08 AM by Reinhold Graf RSS

    Custom Sort

    Reinhold Graf

      I need to establish a custom sort (as per Division).

       

      Data comes in disordered.

      After that, I sort the Divisions as follows:

       

      TextSort:

          mapping

              load * inline

                  [Text,SortOrder

                      'RIDI DE',1

                      'Berlux',2

                      'RIDI PL',3

                      'RIDI AT',4

                      'RIDI UK',5

                      'RIDI CH',6

                      'RIDI FR',7;

         

      Dual(Division,Applymap('TextSort',Division);

       

      But, it doesn't work.

      If I use Custom-Sort / numerical, the sort-order isn't as above.

       

      What am I doing wrong ?

        • Re: Custom Sort
          Ruben Marin

          Hi Reinhold, first load the mapping table (you left the close bracket, and doesn't needs to be between single quotes):

          TextSort:

              mapping

                  load * inline

                      [Text,SortOrder

                          RIDI DE,1

                          Berlux,2

                          RIDI PL,3

                          RIDI AT,4

                          RIDI UK,5

                          RIDI CH,6

                          RIDI FR,7

          ];

           

          then load the divisions applying the map:

          [03) Divisionen]:

          LOAD Dual([Test],Applymap('TextSort',[Test]) as Division;

          FROM [lib://produktiv/Division-Test.xlsx]

          (ooxml, embedded labels, table is [03) Divisionen]);

          • Re: Custom Sort
            Reinhold Graf

            Thanks a lot - working now

             

            For other newbies:

            • add a second ')' to [Test])
            • leave ';' after as Division;