[thelist] 1.1.2 Sorting

.jeff jeff at members.evolt.org
Thu Dec 5 16:46:00 CST 2002


> From: Ed McCarroll
> A text sort would work if all of the numerics were
> zero-padded to a fixed number of digits, e.g. "12.3.4"
> becomes "012.003.004".

sure, but not only does it look funny when output, it has to be adjusted any
time a level exceeds the number of elements that padding supports.  for
example, let's say you decided that you were going to pad with a single zero
(01.01.03).  you now have a limitation of 99 (100 if it's zero-based) items
per element (99.99.99).  what happens if you break that (01.100.01)?  well,
now you've gotta go back through and update all elements in the affected
position and add a zero to the front of each one.

however, on the flip-side, this would surely be a far better performing
option than trying to do the appending and what not on the fly before
performing the sort.

even better yet would be to have an independent column named something
appropriate like "rank".  this column could be controlled by the user
independently of the dot-delimited digits data.  a numeric sort will fly
compared to an indexed text sort any day.


jeff at members.evolt.org

More information about the thelist mailing list