Data.DB.TIndexDef.DescFields

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property DescFields: string read FDescFields write SetDescFields;

C++

__property System::UnicodeString DescFields = {read=FDescFields, write=SetDescFields};

Properties

Type Visibility Source Unit Parent
property published
Data.DB.pas
Data.DB.hpp
Data.DB TIndexDef

Description

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

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";
...



See Also