Equations and calculations
- Last Updated: June 24, 2022
- 1 minute read
- Corticon
- Version 7.2
- Documentation
As you model rules, you may need to derive the value of an attribute from a calculation. For example, in a supermarket where a customer gets a discount of 2% if the total price of items in their shopping cart is greater than or equal to 100. To facilitate it, you would need a rule that checks if the total price of all items is greater than 100 and if so, deduct the discount from it to arrive at a new total. This rule would look like:
When you define an equation in an action row , the corresponding cells in rule columns turn into checkboxes. You must select the checkbox in the appropriate column (in this example, column 1) for the action to be triggered.
When the Rulesheet is processed at runtime, Corticon populates the attribute values on the right side of the equation, performs the calculation, and assigns the result of the expression to the attribute on the left side of the equation.