Datasnap.DBClient.TCustomClientDataSet.AddIndex
Delphi
procedure AddIndex(const Name, Fields: string; Options: TIndexOptions; const DescFields: string = ''; const CaseInsFields: string = ''; const GroupingLevel: Integer = 0);
C++
void __fastcall AddIndex(const System::UnicodeString Name, const System::UnicodeString Fields, Data::Db::TIndexOptions Options, const System::UnicodeString DescFields = System::UnicodeString(), const System::UnicodeString CaseInsFields = System::UnicodeString(), const int GroupingLevel = 0x0);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | Datasnap.DBClient.pas Datasnap.DBClient.hpp |
Datasnap.DBClient | TCustomClientDataSet |
Description
Creates a new index for the client dataset.
Call AddIndex to create a new index for the client dataset.
Name
is the name of the new index.
Fields
is a semicolon-delimited list of the fields to include in the index.
Options
is a (potentially empty) set that can include as many as three TIndexOptions values. The valid members for that set include:
ixDescending
, which specifies that the index sorts in descending alphanumeric order.ixCaseInsensitive
, which specifies that the index should ignore case when sorting.ixUnique
, which specifies that no two records contain the same data in the field or fields of an index.
Warning: AddIndex raises an exception if you attempt to create an index that includes any other TIndexOptions values.
DescFields is a semicolon-delimited list of field names. Use DescFields instead of an Options value that includes ixDescending
to create an index that is in ascending order on some fields and descending order on others. All fields named in DescFields are sorted in descending order.
CaseInsFields is a semicolon-delimited list of field names. Use CaseInsFields instead of an Options value that includes ixCaseInsensitive
to create an index that is case-insensitive on some fields and case-sensitive on others. All fields named in CaseInsFields are sorted without regard to case.
GroupingLevel is the default grouping level supported by the index. When the client dataset uses this index, grouping information is automatically available for subgroups defined by up to GroupingLevel fields in the index. (If the client dataset uses maintained aggregates, information about more deeply nested groups can become available when the aggregates are defined on a grouping level greater than the default value of the index). GroupingLevel can be any value from 0 to the number of fields in the index.
Note: Indexes added by AddIndex are not saved with data when using SaveToFile. They do not persist when the client dataset is closed. (That is, they are lost when you reopen the client dataset). You cannot call AddIndex when the dataset is closed.
Tip: You can support maintained aggregates using an index added with AddIndex.