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

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

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

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 III
Creator III
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 III
Creator III
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
MVP
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 III
Creator III
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 III
Creator III
Author

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