Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
reinholdgraf
Creator
Creator

Custom Sort

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 ?

1 Solution

Accepted Solutions
rubenmarin

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]);

View solution in original post

2 Replies
rubenmarin

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]);

reinholdgraf
Creator
Creator
Author

Thanks a lot - working now

For other newbies:

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