RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomClientDataSet.AddIndex Method

Creates a new index for the client dataset.

Pascal
procedure AddIndex(const Name: string; const Fields: string; Options: TIndexOptions; const DescFields: string = ''; const CaseInsFields: string = ''; const GroupingLevel: Integer = 0);
C++
__fastcall AddIndex(const AnsiString Name, const AnsiString Fields, TIndexOptions Options, const AnsiString DescFields = '', const AnsiString CaseInsFields = '', const int GroupingLevel = 0);

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 up to two TIndexOptions values. The valid members for that set include ixDescending (specifying that the index sorts in descending alphanumeric order) and ixCaseInsensitive (specifying that the index should ignore case when sorting).

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 can't call AddIndex when the dataset is closed.
Tip: You can support maintained aggregates using an index added with AddIndex.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!