Interface CompiledFormula

A formula compiled once (compileFormula): the AST, the referenced fields and evaluate() for a row. A formula with a syntax error or an unknown function has error set; evaluate() then always returns it.

Example

const f = compileFormula("[price] * [quantity] * 1.19");
f.fields; // ["price", "quantity"]
f.evaluate({ price: 1299, quantity: 2 }); // 3091.62

Since

1.1.95

Hierarchy

  • CompiledFormula

Properties

The syntax tree; undefined if the formula has an error.

error?: FormulaError

The error of the formula itself (#ERROR!, #NAME? for an unknown function); undefined if it is valid.

fields: readonly string[]

The referenced fields ([price] → "price"), each once, in order of appearance.

source: string

The formula text as given.

usesAggregates: boolean

True if the formula uses a column aggregate (SUM([total]) …).

Methods