Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Alphabetical Sorting in Listbox

Hello,

We have implemented a listbox containing a numeric dimension, string and mixed expressions. We would like to sort all of these dimension and expressions seperately based on variables.  For example;

If variable=1 sort based on dimension

if variable=2 sort based on expression1

if variable=3 sort based on expression2...

We accomplished all of these however we applied sorting on string and mixed expressions only for the first character. What we want is a proper ordering for all of the characters.

Example: 1230adf

               13k

              10b

               alk

               ayk

               ac

                bab

                bzg

                bbk

What we would like to do is:

10b

1230adf

13k

ac

alk

ayk

bab

bbk

bzg                                            

The reason of the sort problem is caused by using "ord" function which is only concerned with the first character of the string. But we have to find a solution for sorting through all the characters. Is anyone ever had this problem before or could you help us with solving the problem and suggest another sort function.

Regards,

4 Replies
bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi,

maybe it is better define the sort order in the script, and then use an expression to choose the criteria.

Field, Sort1, Sort2, Sort3

13k123
alk234
ayk345
bbk456
bzg567
bab678
10b789
ac891
1230adf912
Not applicable
Author

This is only for a limited number of records whereas we need a generic solution since we are dealing with a huge amount of data.

bbi_mba_76
Partner - Specialist
Partner - Specialist

Well, in my cases espressions to sort are not working so fine, so I prefer set the sort in the script.

I found a discussion, but it is quite complicated...

Re. :Re: Sorting column in ASCII mode

Ken_Thomas
Former Employee
Former Employee

I know this is an older post, but I updated an article which attempts to explain the algorithm for sorting of alphanumeric data in Qlik: https://support.qlik.com/articles/000005509

 

-Ken