Checks: ITableChecks;
The Checks property returns table restrictions.
Executing the example requires that the repository contains a table with the TABLE_1 identifier. The table contains a numeric field with the NUM_FIELD identifier.
Sub Main;
Var
MB: IMetabase;
Object: IMetabaseObject;
Table: ITable;
Checks: ITableChecks;
Check: ITableCheck;
Begin
MB := MetabaseClass.Active;
Object := MB.ItemById("TABLE_1").Edit;
Table := Object As ITable;
Checks := Table.Checks;
Check := Checks.Add;
Check.Id := "CheckX";
Check.Name: = "Restriction of digital field value";
Check.Text := "ABS(NUM_FIELD)<100";
Object.Save;
End Sub Main;
After executing the example, a new constraint is created in the table. The constraint checks the absolute value of the NUM_FIELD numeric field.
See also: