Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
March 26 at 10am ET: See how Qlik drives growth and value in ISV segment - REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting based on first digit only

I have numbers that need to be sorted as follows:
0
001
1
10
1000
2
20
202AC
2000X
etc.

I have tried everything I know,
still i am getting following results
0
1
2
10
20
etc
any suggestions?
Thanks,
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi

Can you try loading an expression in the List Box instead of the field directly: =text(YourFieldName) . I think this should give you the desired effect. Let me know if it works;

Cheers,

Dilyana

View solution in original post

15 Replies
Not applicable
Author

Forgot to mention that This for List box

Anonymous
Not applicable
Author

Hm, try sorting the listbox on Expression and use =Text(Fieldname). Hopefully this should give you the desired order.

Not applicable
Author

Hi,

Enable the option Load Order- Orginal under Sort tab in list box

Thanks & Regards

Jai

Not applicable
Author

HI AMEY, CHECK OUT MY QLIKVIEW FILE.

ONE MORE THING, I DON'T THINK YOU CAN LOAD " 1 " AND " 001" AT THE SAME TIME, BECAUSE THEY ARE VIRTUALLY THE SAME. THANKS.

nathanfurby
Specialist
Specialist

Take a look at this modified version of the example that Nathanael provided.

Not applicable
Author

Hi jai,

Thanks! I have used this option already but it is not giving me any desired results.

I believe this Load Order- Orginal option enables you to get a sort order as per data order in databse.

nathanfurby
Specialist
Specialist

Yes it will give you the sort order as loaded - my impression was that you wanted to sort by the 1st number in each field value? Which is what the solution I posted does.

EDIT - Ignore above. Just realised you weren't responding to me.

Not applicable
Author

Hi Nathan,

Thanks! Using this expression option i got results in some list boxes but still i am facing same problem in few other list boxes.

When there are only numbers in a column or alphanumerics starting with a number as initial digit then only i am getting this required results.

But there are some alphanumerics which are starting with alphabets, in that case if i am applying this LEFT(field,1) expression then these numbers started with alphabet are coming first followed by numbers.

my actual requirement is like a column should get sorted first by numerics and then by alphabtes.

currently i am getting below result: PFA

but i want a result like

012TX
101T
2ABC
559
5594A
559LA
559XY
ABC1
TAB32

Anonymous
Not applicable
Author

Hi

Can you try loading an expression in the List Box instead of the field directly: =text(YourFieldName) . I think this should give you the desired effect. Let me know if it works;

Cheers,

Dilyana