Subject | Re: [IBO] Change sort order to some custom logic |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-06-10T10:47:19Z |
>I would like to change the way sorting is handled. Two options seem=203rd: Add leading zeroes.
>to be appropriate:
>1st: change the sort logic in the database (collation order). Will=20
>IBO properly use that order (I know that IBO does some sorting on its=20
>own). Is there a setting that sorts digit-only rows like numbers and=20
>non-digit rows alphabetically?
>2nd: change the OnCompareText method to overwrite the sorting in IBO.=20
>Does this really affect all sorting options? Does IBO never use FB's=20
>ORDER BY clause then?
In my opinion, one main difference between having digits within a character
vs numeric field, is that leading zeroes are significant. In Norway, we
have two "numeric character fields" - PIN code (11 digits) where the two
first digits specify the day you were born and everybody born before the
10th of any month will have a leading zero. Likewise, our postal code (four
digits) has a leading zero for everyone living in Oslo (a bit simplified).
No serious developer would think of these as numbers.
To me, it just doesn't sound right to sort a character field
1,2,10,12,20,21, whereas 01,02,10,12,20,21 does. If you still want to do
that, I suggest you do it through SQL by using CAST(<Field> AS INTEGER) in
your select statement(s) (possibly a hidden column only for the sorting).
HTH,
Set