Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
dia2021
Creator
Creator

Sort Order in the load script

Hi,

How can I sort the column values in a specific order in the load script? For instance, I have one column with Order and another column is with Order description. Where A contains 3 descriptions, B contains 4 descriptions and C contains 5  descriptions. The fields in Order table are sorted alphabetically (A,B,C) but I want the sort order as B,C,A.  Similarly, I want specific sort order for the Description table which is grouped by  Order field rather than sorted default alphabetically.

I got this  at the front end by applying  match function in set expression.

How can I do this in the Load script?

OrderDescription 
BM
 C
 A
 K
  
AQ
 G
 B
  
CD
 B
 A

 

Thanks!

 

Labels (5)
3 Replies
menta
Partner - Creator II
Partner - Creator II

You can use an inline load with the order and join this table. After this you can use your number to order the table.

Load * Inline

[Order, OrderNr

B,1

C,2

A,3];

 

Load *

resident table

order by OrderNr;

dia2021
Creator
Creator
Author

@menta : Thanks for quick reply! That worked! 

It worked for the first column (Order). I also need order for the second column (Description). Currently, its sorting alphabetically in the order mentioned in the below table.

OrderDescription 
BA
 C
 K
 M
  
AB
 G
 Q
  
CA
 B
 D

 

But I need this specific order for the description column through the load script that needs to be group by the "Order" fields. There is a unique description for each "Order". How can I get this through the load script?

OrderDescription 
BM
 C
 A
 K
  
AQ
 G
 B
  
CD
 B
 A
dia2021
Creator
Creator
Author

What is the best possible way to get this? Can it be done through the set analysis? Any kind of help is appreciated!

I'm using Pivot table with the fully expanded Indent rows.