Try OpenEdge Now
skip to main content
BPM Events User's Guide
The rule language : Controlling the actions of a rule : Compound action statements
 

Compound action statements

Use Compound Action statements to group a sequence of Action statements of any kind into a bloc, as shown by the following notation {...}. Use such a bloc at any place where a single Action statement is allowed, for example in the then or else part of a Conditional statement or inside a loop. The general syntax for a compound statement is:
<CompoundStatement> ::=
        "{" (<ActionStatement>)* "}"
In the following example of a rule, the conditional statement in the Action part uses a compound statement in its then part. The compound gathers the two statements:
{ReqStats["ProductOrder"][ evt1.region].count += 1; ReqStats["ProductOrder"][ evt1.region].totalamount += evt1.amount;}
The rule is checking the amount of a purchase order, and decides to apply a discount AND increment some counter, if the amount is more than $500. The last action statement, order.flagOn("continue");, is executed in any case.
rule earlybird_discount
activated by evt1 of BP Server::PI_ACTIVATED{PROCESSTEMPLATENAME : "CustomerRequest"}
then {
    if (evt1.totalamount >= 500)
            {ReqStats["ProductOrder"][ evt1.region].count += 1; ReqStats["ProductOrder"][ evt1.region].totalamount += evt1.amount;}
}