Numeric Transforms
Do arithmetic on two numbers. Operands are read as decimal numbers, so values such as 1.5 and -20 work, and the result is written without trailing zeros.
math
Applies an operator to a left and a right operand. The left operand is the left option if you give one; otherwise it is the input. If either operand is missing or isn't a number, it returns no value.
| Option | Description | Default |
|---|---|---|
| operator | One of + or add, - or subtract, * or multiply, / or divide, % or mod. Any other operator makes the transform return no value. | None: no value is returned |
| left | The left operand. | The input, or the previous step's result in a pipeline |
| input | Used as the left operand when left is not given. | The previous step's result in a pipeline; otherwise none |
| right | The right operand. | None: no value is returned |
- Division is calculated to 10 decimal places, rounding halves up.
- Dividing by zero, or taking the remainder of a division by zero, returns no value.
- Trailing zeros are removed from every result:
1.50 * 2gives3, not3.00. - Operands can be JSON numbers or text, so
2and"2"are the same.
{ "type": "math", "operator": "+", "left": "${baseLeave}", "right": "5" }
baseLeave = 20 → 25
{ "type": "math", "operator": "/", "left": "10", "right": "4" }
→ 2.5
{ "type": "math", "operator": "/", "left": "7", "right": "3" }
→ 2.3333333333
{ "type": "math", "operator": "mod", "left": "17", "right": "5" }
→ 2
{ "type": "math", "operator": "*", "left": "1.50", "right": 2 }
→ 3
In a pipeline, the previous result is the left operand
{ "type": "pipeline", "steps": [
{ "type": "static", "value": "${hoursPerDay}" },
{ "type": "math", "operator": "*", "right": "5" } ] }
hoursPerDay = 8 → 8 → 40
