Function: do()
Evaluates a number of Expressions in sequence and returns the value returned by the last Expression in the list.
Syntax
do(expression1, expression2[,..., expressionN])
Argument | Type | Description |
---|---|---|
expressionN | Expression | Any valid Expression |
If a break() or continue() function is used within the do() then the do() function returns immediately and since it has not reached the last expression in the list a _NULL value will be returned.
Examples
do( $difference = crm.total - billing.total, if( $difference != 0, addElement( $errors, "difference in totals") ), $difference )
The first expression in the list calculates the difference between a total from the CRM system and a corresponding total from the Billing system and then assigns this difference to the $-Variable $difference.
The second expression checks if this value is non-zero (i.e. that there is a difference) and if so adds an error message to the $-Variable $errors which will be an Array containing one or more error messages.
The last expression will evaluate to the value returned by the do() function. Since this is simply the $-Variable $difference this value will be returned.
Note in the above example, the values of $difference and $errors will be available for subsequent Attribute Expressions on the same Stream.