Vincent_L

How to encode a string as a number sorting key, preserving sort order ?

Discussion created by Vincent_L on May 22, 2014
Latest reply on May 22, 2014 by Malcolm

Hi,

 

I've a String, and want to store a number which would a be a sort key. If I sort with the number sort key I should get the string in correct ascending order.

 

Here''re sorme string

 

Albert Einstein > 4556565

Albert Blum > 4525655

 

So sorting it by the sort key would be

 

Albert Blum > 4525655

Albert Einstein > 4556565

 

Of course, if another records arrives like

 

Albert Cohen, its number key would be between 4525655 and 4556565. Meaning, those niumber keys shouldn't be based on a foundset. They need to be absolute (the sring length can be like 32 chars max)

 

That's because another system I use needs to have an integer sorting key

 

Of course 4525655 and 4556565 are just numbers I made off to illustrate the point. I need to know how to generate those number keys

Outcomes