Tutorial: Rule operations
When you’ve added added elements and conditions to your rule, then you can add operations to manipulate values where needed. Operations can also be used in the actions of a rule. There are two types of operations:
Both types of operations have an operator indicating the type of operation that will be performed. Some example operators are:
As you can see, binary operations may have the same operators as equation conditions (i.e., is equal to and is not equal to). In fact, an equation is just a binary operation, but an important difference is that equation conditions trigger rule execution, where operations do not. Another similarity between operations and equation conditions are the values that act as the operands (inputs) which can be:
Example app: Grocery store
In our example app we want to write two different rules:
Rule 1: Calculate shopping cart total price
To implement rule 1, we need the following operation to calculate the total price of the shopping cart:
Rule 2: Calculate volume discount
And the following operation needs to be added to rule 2: