Natural sort for IndexFieldNames (order 1, 2, 11 instead of 1, 11, 2)
You can order your query/table with the property IndexFieldNames. But if you have an varchar field that contains numbers, the order is wrong. You get:
1
11
2
But better would be:
1
2
11
This can be done with the "natural sort" algorithm. Please implement it for the use with IndexFieldNames like:
ATable.IndexFieldNames := 'MyField natural';
I know I could sort it with SQL, but I need client side sorting with the property IndexFieldNames.
For natural sort see:
https://en.wikipedia.org/wiki/Natural_sort_order
(As far I know Windows uses StrCmpLogicalW to sort file names in that way)
5
votes
Sebastian Keseling
shared this idea