Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
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
Kushal_Chawda

what should be the order?

Not applicable
Author

The first i typed :

00A

01A

02A

03A

2

3

Anonymous
Not applicable
Author

if it is regular that only 1 character can occur you may try this in sort Expression ascending:

if (isnum(right(code,1)), code, left(code,len(code)-1))

Digvijay_Singh

Do you have any other check box checked bcz selecting TEXT only option in sort is giving me different result175717.PNG

Kushal_Chawda

Something like this

Data:

LOAD *,

Data2&Data1 as Sort;

LOAD *, if(IsNum(Data),Data) as Data1,if(IsText(Data),Data) as Data2 Inline [

ID,Data

1,00A

4,03A

2,01A

3,02A

5,2

6,3

7,02A

8,03A

9,00A ];

Now Use Sort in listbox

Gysbert_Wassenaar

If the sort order is important then first load the values in the order you want them. Then you can use Load Order as sort option in the listbox object for that field.


talk is cheap, supply exceeds demand
jonathandienst
Partner - Champion III
Partner - Champion III

Enable sort by expression, and use this expression:

=Right('000' & code, 3)

(This should not be necessary, but it will work, and will not require you to know all the values before hand, like many of the solutions above)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Kushal_Chawda

hi jontydkpi I think it will not work when order of the data is not fixed like the data which I have loaded in my post

sasiparupudi1
Master III
Master III

do they all have a suffix A? Could you post your data please?