Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Evan0211
Creator
Creator

Custom sorting a Listbox

I have a Listbox filter pane with strings.

'Standards 1'

'Standards 2'

'Standards 3'

'Below Standards'

I need to have the dropdown list in the order above. If I order it alphabetically, it shows as Below Standards, 1, 2, 3. If I sort it alphabetically descending it is 3, 2, 1, Below Standards.  How can I get it to sort 1, 2, 3, Below Standards?

Labels (4)
3 Replies
PhanThanhSon
Creator II
Creator II

Hi,

You will need to use the dual function here. Here's a good example using Qlik to sort the days of the week, which can't be logically sorted numerically or alphabetically (considering they are just strings).

https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/Scripting/FormattingFunct....


best regards Son

marksouzacosta
Partner - Specialist
Partner - Specialist

Hi @Evan0211,

You have to associate a numeric value to the text values using Dual statement. This way you can customize the sort sequence in any way you need.

StandardList:
LOAD 
	Dual(StandardName,StandardValue) AS StandardName
INLINE [
StandardName, StandardValue
Standards 1, 1
Standards 2, 2
Standards 3, 3
Below Standards, 4
];

The Auto Sorting should work but if not, you can specify in your charts to sort it numerically:

marksouzacosta_0-1719948706955.png

 

 

Read more at Data Voyagers - datavoyagers.net
MatheusC
Specialist
Specialist

@Evan0211 
Try this:

In sort by expression enter,
match(Field, ‘Below Standards’)

and keep it sorting as ascending.

- Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!