PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Numeric/text sorting on a report WD19
Numeric/text sorting on a report WD19
Iniciado por guest, 02,ene. 2016 17:04 - 3 respuestas
Publicado el 02,enero 2016 - 17:04
Hello All,

I have a report that I want to sort on a Item "Lot Number" which is a alpha numeric.

The current results of the sort are 1,10,2,22,23,3 ect is there any way to sort this 1,2,3,4 ect.

Thanks,

DW
Publicado el 02,enero 2016 - 17:23
Hi DW

Your current result is "correct" for alpha-numeric fields.

To get what you want, you could

a) change the item type to numeric, or
b) format the alpha-numeric values with a sufficient number of leading zeroes, for instance, if the maximum number would be 9999, you should format 1 to 0001, 2 to 0002 etc.

best regards
Ola
Publicado el 03,enero 2016 - 12:49
Hi DW,

If you use MYSQL OR another DB than hyperfile, you can try CAST() function with ORDER BY .

Best Regards/
Ab.
Publicado el 03,enero 2016 - 13:37
Hello DW

If you put the data into a memory table and report from the table you can use the extended sort functions of the table on that column which will sort as you require.

Regards
Al