Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Listbox - text sort not ASCII?

Here's a hopefully quick question about listbox sorts, although I suspect it applies everywhere. My listbox is configured to sort by state (auto-ascending) and text (A-Z). My content is reformatted address data, and the numeric portion of my data is being sorted numerically. So I'm getting, for example,

POBOX1

POBOX2

POBOX100

POBOX200

instead of

POBOX1

POBOX100

POBOX2

POBOX200.

Am I missing something fundamental? I thought the nature of a text sort would be pure ASCII, but apparently it's not. The latter sort is what I'm trying to achieve. Thank you.

37 Replies
swuehl
MVP
MVP

Interesting solution, Clever Anjos.

Do you have an explanation for that? Or why it works with an expression in the list box, but not a similar generated field in the script?

Brian Yordnoff wrote:

Curious, has QlikTech spoken on this issue? Is it considered by design or a bug, and, if the latter, do they have a fix date or version in mind?

I don't remember something like that. Sorting seems to be not very well documented (not only text sort, also sort by expression), if not to say documentation is wrong at that text sort place (depending on how you read 'Sorts the field values in alphabetical order.')

But I believe the general text sort behaviour is considered by QT as working as designed, though I think what Clever Anjos used is eventually a bug (though it serves your request).

The more you try to understand the QV sort options, the more confused you get...

Clever_Anjos
Employee
Employee

swuehl, I really don´t understand why it works using an expression into listbox and not into script.

As you, I´m confused why it works this way.

Maybe I´ve used a bug against another bug

Gysbert_Wassenaar

Your expression doesn't work for me. It merely shows the items in load order.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

Gysbert,

Clever Anjos suggested to use a list box field expression, not a sort by expression.

Surprisingly, this seems to work (though I wouldn't be surprised if it's not working on all versions / platforms).

Check attached.

Gysbert_Wassenaar

Ah, clever indeed. 🙂


talk is cheap, supply exceeds demand
Not applicable
Author

I tried this, but no luck. It still selects the entries in place. It does not move them to the top. If I remove the expression, the selected entries move to the top of the list.

Even so, the replacement of field with expression causes a performance hit. It takes several seconds to re-sort the listbox anytime a selection is made. Also, I'm noticing other inconsistent behavior with it -- mainly on reload. In theory, it's an interesting idea, but I don't think it's going to work in our production application. 

I do appreciate yours and the efforts of everyone here.

Clever_Anjos
Employee
Employee

I don´t see how can we proceeed.

I was aware that could lead to perfomance issues, since we´re using an expression instead of a 'pure' field.

As I said, that is small 'workaround' ("gambiarra" in Portuguese) to an known issue.

swuehl
MVP
MVP

I know this thread is three years old but in case someone find it by using the search (it's quite high in the rank):

I think this works as sort expression:

2016-05-31 00_49_00-List Box Properties [Field].png