Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
gerrycastellino
Creator III
Creator III

How do I get the sorting displayed correctly

if(Column10 >0 and Column10 <=2, '0-2',

      if(Column10 > 2 and Column10 <=5, '3-5',

        if(Column10 >5 and Column10 <=10, '5-10',

          if (Column10 > 10, '>10 years'))))  as [Length of Service],        

would like to use dual if possible.

I know I can a prepend on the values by using 1:0-2 and then using subfield in my expression.

Just wondering what are the possibilities here...

I would like to see the order as:

0-2

3-5

5-10

>10 years

Capture.JPG

1 Solution

Accepted Solutions
Gysbert_Wassenaar

The easiest way is to first create a small inline table in the script with the values in the order you want them sorted:

Sort:

LOAD * INLINE [

Length of Service

0-2

3-5

5-10

>10 years

];

Put that above the part that calculates the Length of Service field from the Column10 values.

That way the default sort order (By Load order) is determined by the Sort table you create first.


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar

The easiest way is to first create a small inline table in the script with the values in the order you want them sorted:

Sort:

LOAD * INLINE [

Length of Service

0-2

3-5

5-10

>10 years

];

Put that above the part that calculates the Length of Service field from the Column10 values.

That way the default sort order (By Load order) is determined by the Sort table you create first.


talk is cheap, supply exceeds demand