Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Sorting of List Box Values

I have three values in a list box that I wish to show at the top of the list box then show all other values below in alphabetical order. The three values are:

No Specialty (ALL)

No Specialty (Doctor)

No Specialty (Nurse)

Can anyone help?

Thanks in advance

4 Replies
Not applicable
Author

I have a probably not-so-perfect solution :

create a column where these 3 values have a 1 and others 0 then use this column to sort by the average of the expression. this could be done with a mapping.

Hope this helps

erichshiino
Partner - Master
Partner - Master

this auxiliary field on script definetly works! 

If you want to create something outside scritp, you could use match function:

Sort by expression, descending and use:

= match( YOUR_FIELD, 'No Specialty (Nurse)', 'No Specialty (Doctor)', 'No Specialty (ALL)')

This function will return:

No Specialty (ALL) =  3

No Specialty (Doctor) = 2

No Specialty (Nurse) =1

the others = 0

Rgds,

Erich

Not applicable
Author

Thanks Erich,

When I select another valuen in the list box, it moves these back into alphabetical order. Is there an expression that can sort by whether a value is selected (state) and then keep these three values at the next values in the unselected list below what is selected?

Many thanks,

Chris

erichshiino
Partner - Master
Partner - Master

Ok, you want to keep this order all the time.

Change it to:

= match( only ({1} YOUR_FIELD) , 'No Specialty (Nurse)', 'No Specialty (Doctor)', 'No Specialty (ALL)')

The expression must be the only 'Sort by' condition;

Hope it helps,

Erich