cBase versus Model Sorting
Spectre sorts string data differently from how models sort string data. As you migrate from classic models to cBases, you should be aware of the differences.

Classic DI models use an alphanumeric sort to order string data. Numbers are viewed one character at a time. cBases order string data using natural sort order, which is similar to alphanumeric sort order, but has one important difference when numbers are included in the string: natural sort order sorts string data alphabetically, but multi-digit numbers are viewed as a single number.
For example:
- In alphanumeric sorting, z12 is sorted before z3 because 1 is less than 3.
- In natural sort order sorting, z12 is sorted after z3 because 12 is greater than 3.
NOTE: Spectre allows building columns with the sort-natural=false tag to replicate model sorting. See Text, cBase, and Dive Input Build Tags for more information on using sort-natural in build tags.

The following table shows two examples of how strings are sorted by default—the first grouping shows embedded numbers, the second grouping shows numbers with leading zeros.
Alphanumeric Sort (models) | Natural Order Sort (cBases) |
---|---|
Bldg 1 | Bldg 1 |
Bldg 10 | Bldg 2 |
Bldg 11 | Bldg 3 |
Bldg 2 | Bldg 10 |
Bldg 3 | Bldg 11 |
001 | 001 |
002 |
01 |
01 | 002 |
02 | 02 |
120 | 2 |
124 | 20 |
2 | 120 |
20 | 124 |
NOTE: Spectre allows building columns with the sort-natural=false tag to replicate model sorting. See Text, cBase, and Dive Input Build Tags for more information on using sort-natural in build tags.

The system locale determines when case sensitivity is used in sorts. For example, the locale en_US_Posix is case-sensitive, while en_US and de_DE are not case sensitive. When applicable, cBases ignore lower and upper case characters when sorting strings, whereas in classic models, upper case precedes lower case.
Model Order | cBase Order |
---|---|
AL | AL |
AR | Amsterdam |
AZ | AR |
Amsterdam | Aruba |
Aruba | AZ |
Symbols also sort differently in models from how they sort in cBases.