-
I am trying to find an algorithm that will sort a field I have that stores account codes. The problem I have is that the codes have both numeric and alpha numeric data in them. Eg ABC02;ABC01;1OA29;1OA30 so the algorithm needs to be able to look at each character so that the codes are sorted in logical order. Results should be ==> 10A29;1OA30ABC01;ABC02. I am sure that someone has written this before???
-
I can't see a problem with that.
1 is less than A, so it would be sorted in that order anyway.
Good Luck.
-
Several questions: Where does the data come from? Do you want to store the data sorted, or just display it sorted? How many data items will there be?
-
in ascii, the 1 is less than a isn't it, maybe use that...
-
Sorted
The data is keyed in by the users. The data is stored as a parent child relationship so in actual fact ABC02 can have a number of associated accounts which will be numbered as ABC01;ABC02. Likewise 1OA29 will have 1OA2901 and 1OA2902..., I have to come up with a report that shows for each parent the range of associated accounts, I was going to use first and last to retrieve the data in a query and hence I need to sort it correctly. Possibly I am approaching this incorrectly not sure...
-
Is the data stored in a database? If so then have you tried the following
"Select * From Accounts order by AccountNbr"