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: 
New-Qlik
Creator II
Creator II

Custom Sort

Hello Everyone ,

I want to implement custom sort on country. i have already tried below two approaches

1. Sort expression match(Country, 'Sweden', 'Denmark', 'Norway', 'Others')

2. in Script creating n inline table 

CountrySort:
MAPPING Load * inline [
"Country " , Sort
Denmark,2
Sweden,1
Norwary,3
Other,4
];

Dual("Country ",Applymap('CountrySort',"Country ")) as "Country"

 

both gives me wrong order.

Any suggestions 

3 Solutions

Accepted Solutions
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

In the back end write in preferred sorting order. Simply write InLine with the same field name you wish to sort. Like

temp_sort_country:
LOAD * INLINE [
Country
Sweden
Lithuania
Denmark
USA
];

 

At the end of the back end script drop the table.

Drop Table temp_sort_country;

View solution in original post

Kushal_Chawda

Another approach

CountrySort:
Load *, Dual("Country ",Sort) as Dual inline [
"Country " , Sort
Denmark,2
Sweden,1
Norwary,3
Other,4
];

Now you can call, Dual field in sort expression

View solution in original post

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If using the temp_sort_country table, make sure you uncheck all the sort options to cause it to use the load order.

-Rob

View solution in original post

10 Replies
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

In the back end write in preferred sorting order. Simply write InLine with the same field name you wish to sort. Like

temp_sort_country:
LOAD * INLINE [
Country
Sweden
Lithuania
Denmark
USA
];

 

At the end of the back end script drop the table.

Drop Table temp_sort_country;

anushree1
Specialist II
Specialist II

where are you trying to have a custom sort

Kushal_Chawda

Another approach

CountrySort:
Load *, Dual("Country ",Sort) as Dual inline [
"Country " , Sort
Denmark,2
Sweden,1
Norwary,3
Other,4
];

Now you can call, Dual field in sort expression

New-Qlik
Creator II
Creator II
Author

Hello,

Nope it didn't work. I have created a tale with preferred order n drop that table at very end of script. but still its shows wrong order.

New-Qlik
Creator II
Creator II
Author

I have tried in Chart--> sorting--> sort by expression and 

in data editor .

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

 Can u please attach the QVF?

Thanks

Thanks and Regards
Kashyap.R
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If using the temp_sort_country table, make sure you uncheck all the sort options to cause it to use the load order.

-Rob

New-Qlik
Creator II
Creator II
Author

Hello,

Thanks for replying i tried but for some reason it didn't work.

I have a dim and in sorting i have added 'Dual' new field , it didn't work. Than i tried 

match(Dual, 'Sweden','Denmark','Norwary','Finland','Other') it didnt work either

New-Qlik
Creator II
Creator II
Author

Yes i have cross checked that too. i have a filter panel with one dim ie country ,