Complex Math Expr
Last updated
Last updated
Complex Math Expr node is designed to evaluate complex mathematical expressions and store the result in a specified variable. This node allows for more sophisticated calculations than simple arithmetic operations.
Field
Description
Required
Node name
true
Variable Name
The name of the variable where the result item will be stored
true
Value
A JSON object representing the mathematical expression to be evaluated
true
Specify a variable name where the result will be stored.
Define the expression using a JSON object with supported operators and functions.
The expression is defined as a JSON object where each key is an operator or function, and its value is an array of operands or arguments. The node supports a wide range of operations as defined in the documentation.
Example:
The node stores the result of the expression evaluation in the specified variable. You can access this using Magical Autocomplete (e.g., $.variables.<variable_name>
) in any node below this node.
Let's say you want to calculate a complex price adjustment with conditions:
Set Variable name to adjusted_price
Set Expression to:
This will apply a 10% discount if the customer has more than 1000 loyalty points, and store the result in the adjusted_price
variable.
Refer to the CQL documentation for the full list of available operators and functions.
Be mindful of the data types you're working with, especially when using type-specific operators or functions.
Also note that the expression can have only one operator at one level. For example: