ITable.Triggers

Syntax

Triggers: ITableTriggers;

Description

The Triggers property returns an object containing all triggers of the table.

Example

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

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

Table: ITable;

Triggers: ITableTriggers;

Trigger: ITableTrigger;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemById("TABLE_1").Edit;

Table := MObj As ITable;

Triggers := Table.Triggers;

Trigger := Triggers.Add;

Trigger.Id := "TriggerX";

Trigger.Name: = "Table trigger";

Trigger.Text := "Begin" + #10 + "Insert Into Table_1(Field_1) Values('Trigger');" + #10 + "End;";

Trigger.FireTime := TableTriggerFireTime.After;

Trigger.FireEvent := TableTriggerFireEvent.Insert;

Trigger.ForEachRow := True;

MObj.Save;

End Sub Main;

After executing the example, the trigger with the TriggerX identifier is created in the table. This trigger is executed before an insert of a new row into the table. One more new row is added into the table and value of the Field_1 field is filled at trigger execution.

See also:

ITable