The math operation calculates a value from a formula. You write the expression, PalDock fills in the field values and works out the result.
This operation was previously called match, which was a typo.
How it works
Write the formula in the parameter. Reference field values in braces:
{value}is the value the step is working with.{field_name}is any other field in the scenario.
Formula: {value} * 2
Input: 30
Result: 60
Formula: {price} / 100
Input: 19900
Result: 199
You can combine several fields in one formula, for example {length} * {width}.
What you can write
Operators
+addition-subtraction*multiplication/division^exponentiation( )parentheses, to control what is calculated first
Functions
sqrt(x)square rootabs(x)absolute valueround(x)round to the nearest whole numberfloor(x)round downceil(x)round uplog(x)natural logarithmsin(x)andcos(x)
When the calculation fails
If the formula cannot be worked out, the field keeps its original value. Nothing is written to the log, no error is raised, and the flow carries on.
That makes a broken formula genuinely hard to spot, because the value that arrives at the advertiser looks plausible, it is just the number from before the calculation. A field of 19900 that should have become 199 still reads as an amount.
The usual causes are an empty input field, a value that is text rather than a number, and a reference to a field that does not exist in this scenario, which leaves the braces unreplaced.
So check the input before you calculate. Convert with to-float or to-int first, and put a condition on the step so it only runs when the field actually holds a number.
Rounding
Division produces decimals, and most advertisers will not thank you for 66.66666666666667.
Wrap the formula in round(), floor() or ceil() depending on what the value means. Rounding down is the safe choice for anything the advertiser will treat as a limit, since rounding up can push you over it.
Settings
The operation takes one parameter: the formula. Everything else is the source and the condition.
Reference
Calculations are performed by chriskonnertz/string-calc, which is where the full list of supported functions lives.

