Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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
MVP
MVP

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
MVP
MVP

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;