Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sorting the values in a listbox when using an expression in the sort tab

Hi

I want to know if anyone knows how to sort the values in a listbox, when one is forced to have an expression in the sort tab?

I had to use the same expression from the general tab in the sort tab

if(datakilde='Aarlig', Aktivitetsnavn)

-  otherwise the listbox didn't show the associated values (from a selected value from another listbox) in the top of the listbox - which aren't very user friendly.

But as a consequence the sorting in alphabetic order is no longer works...

See my sort tab below.

Kind Regards Maria

112.png

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I got a tip from Stackoverflow that said:

There are multiple solutions on this, but I think the correct one, would be to create a field in your datamodel, that contains just the values that need in the listbox.

Listboxes are not very good at filtering data. So take your if statement, and put it into the source table:

if(datakilde='Aarlig', Aktivitetsnavn) as Aktivitetsnavn_2

Then you don't have to struggle with filtering data in listboxes and your sorting will be correct.

After I put the if statement in the script instead of the listbox, it worked. Now I don't need to use an expression in the general tab and because of that I don't have any problems with the associated values not being shown i the top of the listbox. And therefore I don't need the expression i the sort tab either- which now has resulted in no problems with the sorting in the listbox.

View solution in original post

12 Replies
Gysbert_Wassenaar

It sometimes helps to set Sort by State to Ascending instead of Auto Ascending.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

I already did that - but the result is the same.

Gysbert_Wassenaar

Can you post a qlikview document that demonstrates the problem? If you're worried about confidential data, please read this document first: Preparing examples for Upload - Reduction and Data Scrambling


talk is cheap, supply exceeds demand
MarcoWedel

Hi maria,

did you use the sorting expression, when trying Gysbert's "Sort by State Ascending" suggestion?

without a sorting expression, just sorting by state ascending and text ascending seems to work:

QlikCommunity_Thread_115602_Pic2.JPG.jpg

whereas other settings show the behaviour, you described:

QlikCommunity_Thread_115602_Pic1.JPG.jpg

QlikCommunity_Thread_115602_Pic4.JPG.jpg

QlikCommunity_Thread_115602_Pic3.JPG.jpg

regards

Marco

Anonymous
Not applicable
Author

I have now made my document ready to be posted in here.

Probably a stupid question, but how do I oploead the Qlikview document?

MarcoWedel

in the editor window click "use advanced editor" in the upper right and then "attach" in the lower right corner.

regards

Marco

Anonymous
Not applicable
Author

Ok, thanks. Here is my Qlikview document - I hope someone is able to help me sort the values in the listbox in the bottom - where one can search. I hope it is not inconvenient that I used the scramble option?

MarcoWedel

I don't see any sorting issues when using the sorting setting "state ascending" like Gysbert suggested:

QlikCommunity_Thread_115602_Pic3.JPG.jpg

QlikCommunity_Thread_115602_Pic2.JPG.jpg

Do you still expect any different behaviour?

regards

Marco

Anonymous
Not applicable
Author

When I unclick the expression in the sorting tab and only activate state with "ascending" and text with "a-z", I get the following:

listbox.png

shot.png