RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TIndexDef.DescFields Property

Specifies the fields of the index that are sorted in descending order.

Pascal
property DescFields: string;
C++
__property AnsiString DescFields;

Set DescFields to a string that lists the names of fields in the index, separated by semicolons. The ordering imposed by the index on the fields specified in DescFields is descending. Fields in the index definition but not in the DescFields list use the default ascending order. It is possible for a single index to have fields using both ascending and descending ordering. 

For a field to be included in DescFields, the field must be included in the fields on which the index is based. These fields are specified in the Fields property of the TIndexDef object.

Note: Not all database servers support both ascending and descending field orderings in the same index. Consult the documentation for the particular database server to determine whether this is actually supported.
In the example below, the DescFields property is given a list of two table fields for the index being created: TransDate and Company.

with Table1 do begin
  ...
  with IndexDefs do begin
    with AddIndexDef do begin
      Name := 'MultiIndex'
      Fields := 'TransDate;Company;State'
      Options := [ixUnique];
    end;
    Items[IndexDefs.Count – 1].DescInFields := 'TransDate;Company';
  end;
  ...
  CreateTable;
end;

 

...
Table1->IndexDefs->Add("MultiIndex","TransDate;Company;State",
  TIndexOptions() << ixUnique);
Table1->IndexDefs->Items[Table1->IndexDefs->Count-1]->DescFields = "TransDate;Company";
...

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!