<< Click to Display Table of Contents >> Navigation: Collation and Sorting > Sort Order |
This is an important topic that affects virtually every database developer and application written using any database engine, not just Apollo.
By default, Windows sort order places "-" before " " (dash before the space). This may not be the desired behavior for legacy DOS systems. To customize your collation sequence and share data with DOS applications (OEM sorting), call the Query objects SetMachineCollation before opening or updating your tables.
Normally, data is expected to sort as follows:
test Note: DOS sorts " " before "-"
test - 1
test 1
However under Windows (Apollo uses Windows Sort Rules by default), the default linguistic ordering is actually as follows:
test - 1 Note: Windows sorts "-" before the " "
test
test 1
Solution #1
Call SetMachineCollation to use the sorting rules used under DOS.
procedure TForm1.Initialize;
begin
SDEEngine.SetMachineCollation;
// or set System Collation as follows:
// SDEEngine.SetSystemCollation;
End;
Solution #2
Call TApolloEnv.SysProp( SDE_SP_SETCHRCOLLATE, [array of chars]) to set a custom ordering rules.
Both solutions are global and affect all tables.