Sort Report by Numeric Value


I created a report in Clarion 8 application and sorting the records by number.

Instead of order: 1,2,3,4,5,6,7,8,9,10
I get a return----> 1,10,2 3 4 5 6 7 8 9

Please can you help

Kind regards

It looks like you have a String field to store numbers so that’s why it sort like this.


As @Clarion_clarion said your KEY field is probably a STRING? You could paste some of your file declaration to help us. Changing your File field to a LONG is one choice, or …

Reports use the VIEW engine. You could remove the KEY from the Report and set a specific PROP:Order. That supports Expressions like Evaluate() does. To turn your STRING into a Number include it in a Formula (w.g. 1+String) or use a Numeric function like INT() e.g.

Process:View{PROP:Order}='(1 + Pre:SomeStringField)'   !Math with STRING results in Number