Unique: Boolean;
The Unique property determines whether an index is unique.
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.Unique := True;
(Table As IMetabaseObject).Save;
End Sub Main;
After executing the example, the unique index is created in the table. The index is created by two first fields of the table.
See also: