EasyTable: Single-File Embedded BDE Replacement
Database for Delphi and C++Builder
Creates a new index for the table.
procedure AddIndex(const Name, Fields: String; Options: TIndexOptions;const DescFields: String=''; const CaseInsFields: String='');
Call AddIndex to create a new index for an existing table associated with a dataset component. The index created with this procedure is added to the database table corresponding to the dataset component.
Name is the name of a new index. Name must not contain @ character. This character is used in automatically created internal indexes.
Fields is a String value containing the field or fields which are used to serve as a base for the new index. If more than one field is used, separate the field names in the list with semi-colons.
Options is a set of attributes for the index. The Options parameter may contain any, multiple, or none of the TIndexOptions constants: ixPrimary, ixDescending, and ixCaseInsensitive. See the topic for the TIndexOptions type for definitions of individual constants and for implications of using them.
DescFields is a string containing a list of field names, separated by semi-colons. DescFields specifies fields with descending ordering for the new index. Fields in the index definition but not in the DescFields list use the default ascending ordering. It is possible that a single index can have fields using both ascending and descending ordering.
CaseInsFields is a string containing a list of field names, separated by semi-colons. CaseInsFields specifies case insensitive fields for the new index. Fields in the index definition but not in the CaseInsFields list use the default case sensivity option. It is possible that a single index can have fields using both case sensitive and case insensitive options.
EasyTable1.AddIndex('MostPaid', 'CustNo;SaleDate;AmountPaid', [ixCaseInsensitive], 'SaleDate;AmountPaid');
If AutoIndexes was True on table creation then ascending indexes are automatically created for each table field. The names of these indexes starts from @ character and contain name of indexed field.
For example: @CustNo, @SaleDate are the auto-indexes for fields CustNo and SaleDate.