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

Assignment action statements

Use the Assignment statements to assign new values to declared variable identifiers or to infopad cells. The general syntax for an assignment statement is:
<AssignmentStatement> ::=
        <identifier> ":=" <expression> ";" |
        <identifier> "+=" <numeric_expression> ";" |
        <identifier> "-=" <numeric_expression> ";" |
        <identifier> "++" |
        <identifier> "--" |
        <identifier> "::=" <updating_functional_expression> ";" |
We provide the following three examples:
1. ReqStats["ProductOrder"][ evt1.region].totalamount := 0;
In the first example, the value 0 is assigned to the totalamount slot of the infopad cell identified by row: "ProductOrder" and column given in event attribute: evt1.region.
2. ReqStats["ProductOrder"][ evt1.region].maxamount ::= max(evt1.amount);
In example 2, the maximum between the slot: maxamount of the infopad cell and the event attribute: evt1.amount is calculated, and reassigned to the maxamount slot. The operator "::=" indicates that it does NOT mention the first argument of the function on the right side (that is, max), assumed to be the same as the expression on the left side. You may rewrite Example 2 using the normal ":=" assignment operator, but it would then be longer, as shown in Example 2’ below:
(2’) ReqStats["ProductOrder"][ evt1.region].maxamount := max(ReqStats["ProductOrder"][ evt1.region].maxamount, evt1.amount);
3. ReqStats["ProductOrder"][ evt1.region].totalamount += evt1.amount;
In Example 3, the operator "+=" is a contraction commonly used in programming languages, for incrementing the left hand side identifier with the value in right hand side. The operator "++" indicates that the value of the left hand side identifier is incremented by 1.
* Infopad variables