The calculation expression string to evaluate
Form elements definition. Used to resolve nested form element values
referenced in the expression and to validate {ELEMENT:...} references.
Parse YYYY-MM-DD strings when resolving date element values. sdk-core
only calls this for day-only values; other date strings use
new Date(value).
Form submission data used to resolve {ELEMENT:...} references
A discriminated result describing the outcome of evaluation. Empty
expressions and parse failures return
{ type: 'INVALID_EXPRESSION', error }. Unexpected runtime errors are
rethrown.
Evaluate a OneBlink calculation expression against form submission data.
Day-only (
YYYY-MM-DD) date parsing is injected viaparseDayOnlyDateso callers control timezone-aware behaviour (client vs server), matching the pattern used byconditionalLogicService. Other date strings usenew Date(value).Expression syntax
Expressions are mathematical / logical formulas. Form element values are referenced with
{ELEMENT:<elementName>}tags (including nested paths via|, e.g.{ELEMENT:Children|Age}).Literals
0,5,5.4"abc",'abc'true,falseArithmetic operators
+1 + 2→3-1 - 2→-1*4 * 2→8/4 / 2→2%8 % 3→2++++2→3----2→1Standard operator precedence applies. Use parentheses to override it, e.g.
3 * (2 + 1)→9.Comparison operators
==2 == 2→true!=2 != 3→true>2 > 1→true>=2 >= 2→true<2 < 3→true<=2 <= 2→trueLogical operators
&&true && false→false||false || true→true!!false→trueElement references
{ELEMENT:Number}— value of the root element namedNumber{ELEMENT:Set\|Child}— value ofChildwithin repeatable set / nested form elementSet{ELEMENT:Parents\|Children\|Age}How values are coerced for evaluation:
YYYY-MM-DD) strings are parsed viaparseDayOnlyDate; other non-numeric date strings usenew Date(value). Valid dates useDate#getTime(), otherwise the string is parsed as a float viaparseFloatNaN(result typeMISSING_VALUES)valuepropertyBuilt-in functions
ROUND(value, precision)valuetoprecisiondecimal places (correct floating-point rounds)ROUND(1.255, 2)→1.26ROUND_DOWN(value)Math.floor)ROUND_DOWN(1.9)→1ROUND_UP(value)Math.ceil)ROUND_UP(1.1)→2ISNULL(value, defaultValue)valueis unentered (null/undefined/""), returndefaultValueor0; otherwise returnvalueISNULL({ELEMENT:A}, 10)ROUND,ROUND_DOWN, andROUND_UPreturnnullwhenvalueisNaNor not finite.Examples