Specifies the syntax associated to the Transaction’s rules.
<RuleName> [if <condition>] [on <event1>,...,<eventN>] [level <Att1>,...,<AttN>] [dependencies <Att1>;...;<AttN>|<&var1>;...;<&varN>];
View Syntax conventions
Specifies a Transaction rule.
Is the boolean expression that details the conditions that must be fulfilled to trigger the rule. It can be composed of logic operators (and, or, not).
Is the event or list of events separated by “,”. The possible values are AfterInsert, AfterUpdate, AfterDelete, AfterValidate, AfterComplete, AfterLevel, BeforeValidate, BeforeInsert, BeforeUpdate, BeforeDelete and BeforeComplete.
Is the attribute or list of attributes separated by “,” determining the level of the transaction where the rule applies; the first level is assumed in case the section level is not specified.
Att1,...,AttN | &var1,...,&varN
Is an attribute (or variable), or a list of them separated by ";". The Dependencies clause determines that the rule will be triggered upon accepting those attributes (variables).
The syntax of the transaction rules can be logically divided into two sections: condition and triggering event. The condition section is used to specify an expression that must be evaluated to execute the rule. The triggering event details the events where the rule must be triggered, which are associated with the on and level sections.
Given the following Transaction object:
The following are some detailed examples using this syntax:
Assigning a value on the AfterValidate (same to BeforeInsert) event:
ClientType = 1 If Insert On AfterValidate;
ClientType = 1 On BeforeInsert;
Calling a Procedure on the AfterInsert or AfterUpdate event:
Proc(ClientId) On AfterInsert, AfterUpdate;
Executing the rule error if a maximum is reached:
Error('Maximum reached') If ClientBalance > &Max On AfterValidate;
Calling a log Procedure on the AfterInsert or AfterDelete event:
Proc1(ClientId, &Mode) On AfterInsert, AfterDelete;
Calling a Procedure after the level associated with the attribute ClientPhoneId:
Proc2(ClientId) On AfterLevel Level ClientPhoneId;
Triggering events for rules in Transactions