Add Variable
Add Variable node is designed to perform addition operations and store the result in a specified variable. This node can add a value to an existing variable.
Properties Panel
Field | Description | Required |
Node name | true | |
Variable Name | The name of the variable where the result will be stored | true |
Value | The value to be added | true |
Usage
Specify a variable name whose value needs to be fetched and then the result will be stored.
Enter the value to be added.
Behaviour
If the specified variable doesn't exist, it will raise an error.
If the variable already exists, the provided value will be added to the current value of the variable.
Returns
The node stores the result of the addition in the specified variable. You can access this using Magical Autocomplete (e.g., $.variables.<variable_name>
) in any node below this node.
Example
Let's say you want to keep a count of processed items:
Set Variable name to
$.variables.processed_count
Set Value to
1
If the value of processed_count
was 3
, it will now be 4
. If such variable doesn't exist, it'll raise an error.
Best Practices
Be aware of the data type of your variables. This node performs numeric addition, so non-numeric values may lead to unexpected results.
Ensure that the variable is initialised earlier.
Last updated