Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort with zeroes leading values

Hi,

i have a table with a field "code" like this:

00A

01A

02A

03A

2

3

If i put this field in a table o in a list box and set order by TEXT, i have this result:

00A

01A

2

02A

3

03A

that's not correct... value 2 must be after 02A and after 03A.

I already try to add the function TEXT(code) in loading.

Any ideas?

Thanks

13 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

It does sort the data the way the OP requested, and it does not require you to know all the codes (and manually sort them) beforehand. It does assume that nothing is longer than 3 characters.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thanks all for reply,

but data are not so simple, i wrote only an example. The field lenght can be more than 3 chars and can contains numbers and letters (and more than one "0" in the left).

I resolve in this way: in the table and in the field box i use then expression "=text(code)" instead of "code".

Then sorting by TEXT and it works.

antoniotiman
Master III
Master III

Hi Andrea,

in Tab Sort -> Expression

Rank(Field)    desc

Regards,

Antonio

awhitfield
Partner - Champion
Partner - Champion

Hi Andrea,

just loaded the data like:


Sort:
Load * Inline
[
Data
00A
01A
02A
03A
2
3
]
;

Added to a list box with the default sort and it's appears to be as you wish

Confused!

Andy