the formula, e.g. "[price] * [quantity] * 1.19" (a leading = is ignored)
Optional options: FormulaOptionsIfown functions
the compiled formula
const gross = compileFormula("ROUND([price] * [quantity] * 1.19, 2)");
gross.evaluate({ price: 25, quantity: 10 }); // 297.5
compileFormula("[price] / 0").evaluate({ price: 1 }); // FormulaError #DIV/0!
compileFormula("[price] *").error?.code; // "#ERROR!"
1.1.95
Compiles a formula once – no
eval, nonew Function(works with a strict Content-Security-Policy, user input cannot run code). The result evaluates rows; never throws.Syntax (details: instructions.md „Formulas“):
[price],[address.city],[Unit price]– own properties of the row or calculated columns12,1.5,1e3, texts"a"/'a',TRUE,FALSE+ - * / ^(power),&(text),= <> < <= > >=;-2^2 = -4ROUND(x, 2),IF(c, a, b),IFERROR,AND,OR,NOT,ABS,MOD,SQRT,POWER,FLOOR,CEILING,CONCAT,LEN,UPPER,LOWER,TRIM,ISBLANK;SUM AVG MIN MAX COUNT– with one field the aggregate of the column ([total] / SUM([total])), otherwise of the arguments