Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

reinholdgraf
Contributor

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

Re: Custom Sort

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

2 Replies

Re: Custom Sort

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
Contributor

Re: Custom Sort

Thanks a lot - working now

For other newbies:

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