Fields: ITableIndexFields;
The Fields property returns the collection of table fields by which the index is created.
Executing the example requires that the repository contains a table with the Table_1 identifier. The table contains at least two fields.
Sub Main;
Var
MB: IMetabase;
Table: ITable;
Fields: ITableFields;
Index: ITableIndex;
Begin
MB := MetabaseClass.Active;
Table := MB.ItemById("Table_1").Edit As ITable;
Fields := Table.Fields;
Index := Table.Indexes.Add;
Index.Fields.Add(Fields.Item(0));
Index.Fields.Add(Fields.Item(1));
Index.Primary := True;
(Table As IMetabaseObject).Save;
End Sub Main;
After executing the example, the primary index is created in the table. This index is created by two first fields of the table.
See also: