Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am struggling with the sorting behavior in list boxes and can't figure out how to make it work.
I have a couple of list boxes with multiple entries that I want to have sorted in a specific order. When selecting one or more elements, the selected elements should come first, then the not selected elements. The important part: Also the not selected elements should keep their order.
To maintain my sorting order, I added a separate 'sorting column' to my data model.
This is a simpli !fied example with just for entries:
Data:
LOAD * Inline [
Letter, Sort
H, 10
P, 40
L, 30
E, 20
];
My expectation was that having the following settings in my list box should work correctly:
Unfortunately, although the sorting works when not selecting anything, the order gets messed up when selecting e.g. the letter 'L':
Again, my expectation was to have L on top, and then H > E > P below. But somehow the sorting order only applies to the selection.
Any ideas how to fix that or why this behavior happens?
Try this sort expression:
=Only({1} Sort)
Quick and easy. Thanks a lot!
As Sunny has pointed out, your values for "Sort" are not available when you make a selection, and the {1} will fix that.
I'd like to suggest that it may be easier to deal with this by using "Load Order", rather than an expression.
Establishing a Sort Order | Qlikview Cookbook
-Rob
Thanks, Rob.
I thought about using load order as well and might play around with that a little more too.
Given the layout of the data sources and the data model in general, having a separate column is my preferred solution at this point. But as always, it's great to have some alternatives available.
Thank you! This 5 year old post has helped me solve a problem I've had for a couple of days.