AnyDAC
ContentsIndexHome
PreviousUpNext
TADFormatOptions.SortOptions Property

Specifies the default sort options for the local sorting operations.

Group
Links

Use the SortOptions property to specify the default sorting options for the local sorting operations. See TADIndex.Options for details. The default value is []. 

The local sorting is performed by the TADDataSet.IndexFieldNames and TADDataSet.Indexes properties. The SortOptions is the default value for an index in the Indexes collection and may be overridden by the TADIndex.Options property. The SortOptions is the only way to specify the options for IndexFieldNames

For TADMemTable, TADQuery and TADStoredProc the specifying of SortOptions is always optional. For TADTable it may be required, when the database collation differs from the default locale. Then consider to specify soNoCase, soNullLess, soNoSymbols. 

Additionally the SortLocale may be used.

property SortOptions: TADSortOptions;

Setup TADTable to query the Firebird database with ISO8859_1 character set containing German language string data:

uses
  Windows;
...
// Set locale ID to German phone book collation
ADTable1.FormatOptions.SortLocale := MAKELCID(MAKELANGID (LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT);
// Use the the punctuation and other symbols insensitive sorting
ADTable1.FormatOptions.SortOptions := [soNoSymbols];
ADTable1.IndexFieldNames := 'NAME';
ADTable1.TableName := 'CUSTOMERS';
ADTable1.Open;

Setup IndexFieldNames sort order properties for TADMemTable:

ADMemTable1.FormatOptions.SortOptions := [soNullFirst, soNoCase];
ADMemTable1.IndexFieldNames := 'SECOND_NAME;FIRST_NAME';
What do you think about this topic? Send feedback!