ITableField.IsIdentity

Syntax

IsIdentity: Boolean;

Description

The IsIdentity property determines that values of this field identify each string of data in the unique way.

Comments

If the property is set to True, the indicator, that this field is data identity field identifying every row of data in unique way, is set. Setting the IsIdentity property to True does not lead to creation of unique indexes. The property can be used only for a identification of fields that can be included to unique indexes in further.

By default the property is set to False.

Example

Executing this example requires that the repository contains a table with the Table_1 identifier.

Sub UserProc;
Var
    MB: IMetabase;
    Table: ITable;
    Field: ITableField;
    Index: ITableIndex;
Begin
    MB := MetabaseClass.Active;
    Table := MB.ItemById("Table_1").Edit As ITable;
    //New field,  by which unique index is created
    Field := Table.Fields.Add;
    Field.DataType := DbDataType.Integer;
    Field.Id := "UniqueField";
    Field.IsIdentity := True;
    //New unique index
    Index := Table.Indexes.Add;
    Index.Fields.Add(Field);
    Index.Id := "UniqueIndex";
    Index.Unique := True;
    (Table As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, a new field is created in the table. The unique index is created by this field. Indicator that its values identify every row of data in the unique way, is also set for this field.

See also:

ITableField