ExpressionOptions

View as Markdown

Options for managing Expressions in AdapTable's Query Language

TypeScript
export interface

Properties

PropertyTypeDescriptionDefault
caseSensitiveExpressionsbooleanPerform case-sensitive text comparisons when evaluating Expressionsfalse
customAggregatedFunctionsRecord<string,AggregatedExpressionFunction> | ((context:GlobalExpressionFunctionsContext<string>) => Record<string,AggregatedExpressionFunction>)Bespoke Aggregated Expression Functions — to complement those provided by
AdapTable (Calculated Column Aggregated / Alert Aggregated).

Omit category (or set 'Aggregation') to list under the Aggregation
Functions-menu section; any other string creates a section with that name.
Use isAvailable with to limit
modules (Alert / Calculated Column only — not Layout Row Summary or Cell
Summary). Toolbar chips still use expressionEditorButtons.

The reducer receives currentValue as the computed input for that
row (the aggregation's input expression, not necessarily a raw column
cell). aggColumnId is set only when the input is a bare column ref.
A name registered in both customStandardFunctions and this map is a
dual name: NAME() is row-wise, NAME{…} is the aggregation.
Extra constants are positional args; per-row logic is a custom
scalar used as the input.

Every aggregation accepts GROUP_BY and WHERE. Further clauses are
capabilities the definition declares: cumulative (accept
CUMULATIVE([orderCol]) — a running value per row), weight (accept
WEIGHT([col]), delivered as weightValue) and returnType (static
result type for Calculated Column data type / type checks). Declared
capabilities are picked up automatically by validation, the Expression
Editor clause chips, the Cumulative editor and the Query Builder.
extends is not supported for aggregations.
undefined (none)
customStandardFunctionsRecord<string,AdaptableCustomExpressionFunctionEntry> | ((context:GlobalExpressionFunctionsContext<ScalarFunctionName>) => Record<string,AdaptableCustomExpressionFunctionEntry>)Bespoke Standard Expression Functions — to complement those provided by
AdapTable. “Standard” matches the Expression Editor (vs Aggregated).

Registers both value-producing functions and boolean predicates. A custom
function is treated as a boolean predicate (usable as a filter or alert
condition) only when it declares returnType: 'boolean' — predicates
MUST set that property. returnType is required; use a value from
EXPRESSION_RETURN_TYPES ('boolean' | 'number' | 'string' | 'date' |
'object' | 'null' | 'any').

Set category to a value from EXPRESSION_CATEGORIES (e.g. 'date',
'general', 'custom') so the function appears in the matching Expression
Editor menu. Omit category (or use 'custom') for the Custom menu; any
other string creates a menu with that name.

Entries are flat objects combining the AQL evaluation props
(handler, returnType, operands, docs) with the Adaptable
presentation / availability props (label, icon, isAvailable, …) —
see AdaptableCustomExpressionFunction. Alternatively an entry may be
an AdaptableCustomExpressionFunctionWithExtends partial that inherits
metadata from a system (or previously registered custom) function via
extends — useful when overriding a system operator such as IS_BLANK
while keeping its label / icon / operands.

Boolean predicates stay Expression-Editor-only unless they declare
returnType: 'boolean' and operands with arity 1 or 2 (column-only, or
column + value). Optional label is used in the operator picker.
operands of arity 0 / 3+ do not appear in Query Builder / ColumnFilter.

Toolbar chips are separate: use expressionEditorButtons (same as for
system functions).
undefined (none)
displayColumnFriendlyNamesForExpressionsbooleanReference a Column's Header (i.e. FriendlyName) in all Expression overviews (instead of ColumnId)true
editorOptionsExpressionEditorOptionsWhich UI editors are available for Boolean Expressions, and which opens first
evaluateAdaptableQLExternally(context:EvaluateExpressionExternallyContext<TData>) => booleanWhether a Module (or specific expression) should be evaluated by AdaptableQLAll Modules are evaluated by AdapTable
evaluateDatesUsingTimeboolean | ((context:AdaptableColumnContext) => boolean)Whether date comparisons use the full timestamp (exact instant) rather than the calendar day.

Affects the IN operator on date columns wherever Expressions are evaluated
(Queries, Styled Columns, Alerts, Column Filters, ...): true compares the exact
datetime, false compares the calendar day. Also controls whether the date Column
Filter's distinct-value tree drills down to individual times.
When an IN right-hand value is an ISO string containing T, the exact instant is used regardless.
false
expressionEditorButtons(context:ExpressionEditorButtonsContext) =>ExpressionEditorButton[]Customise the function/operator chips shown above the Expression Editor.

Called per editor surface with AdapTable's defaultButtons for that type.
Return those unchanged to keep defaults, or amend/replace them (useful when
adding chips for customStandardFunctions / customAggregatedFunctions).

Editor types are intentionally coarse (e.g. standard covers both boolean
and scalar editors; aggregated covers aggregated scalar and aggregated
boolean) so callers are not forced to treat those as separate concepts.

Only chips whose function is available for the current Module are rendered.
undefined (use AdapTable defaults for each editor type)
fieldsAdaptableField[] | ((context:AdaptableFieldContext) =>AdaptableField[])Fields are items in Data Source that are NOT columns but can be used in Expressions (via FIELD keyword)
isColumnQueryable(queryableColumnContext:QueryableColumnContext) => booleanCan a given column be included in Expressionsundefined (all columns can be used in Expressions)
isExpressionFunctionAvailable(context:GlobalExpressionFunctionAvailabilityContext) => booleanWhether an Expression Function is available in a given Module (or Column).

Called for each Expression Function and Module combination; return true
to make the function available or false to hide it. The context includes
defaultAvailability (whether the function would be available by default),
which can be returned to keep the standard behaviour.

For Column Filter operators the callback is additionally invoked
per-Column with context.column (and context.columnScope) set, so a
different operator set can be offered per Column. column is undefined
for the module-level pass, so guard on it before applying per-Column logic.

Hiding a function never disables a symbol operator: hiding SUM removes
SUM(…) but + still works (likewise = / EQ, > / GT, ? : / IF).
Keyword operators (CONTAINS, IN, CASE, …) are hidden with their function.

Structural functions (COL, FIELD, QUERY, DATE, $SCOPE, NULL,
VAR, TRUE, FALSE, AND, OR, NOT) cannot be hidden; returning
false for them is ignored (and logs a warning).
undefined (all functions have their default availability)
liveRefreshIntervalMsnumberRepaint cadence (in milliseconds) for cells whose rules depend on the clock
(NOW(), IS_PAST(), ROW_AGE{}) or on a sliding window (WITHIN(...)).
0 disables the live refresh — such cells only repaint on data changes.
1000
maxHistoryPerCellnumberRing-buffer capacity per cell for the observable functions (CHANGE_COUNT,
NET_CHANGE, HIGHEST, PREVIOUS, …): how many changes of one cell are
retained for LAST_N / cumulative reads. Also the LAST_N(n) ceiling.
1000
maxTimeframeSizenumberMaximum time (in milliseconds) to hold a Data Change event in a trailing timeframe28800000 (~8 hours)
performExpressionValidationbooleanValidate Expressions before they can be run or savedtrue
queryVariablesQueryVariable[]Query variables that can be referenced in Expressions via VAR('name').
Each variable has a name, a static or resolver value, and an optional description.
Evaluated synchronously with each expression evaluation.
supportedAstContractVersionsnumber[]AST contract versions a ServerSideRowModel / remote evaluator accepts.
Absent means v1 only (raw parse tree). Include 2 to receive
normalized contract-v2 ASTs from expressionApi.getASTForExpression.

Property Details

caseSensitiveExpressions

Perform case-sensitive text comparisons when evaluating Expressions

TypeScript
caseSensitiveExpressions?: boolean;
Default Value

false

Property Value

boolean

customAggregatedFunctions

Bespoke Aggregated Expression Functions — to complement those provided by AdapTable (Calculated Column Aggregated / Alert Aggregated).

Omit category (or set 'Aggregation') to list under the Aggregation Functions-menu section; any other string creates a section with that name. Use isAvailable with to limit modules (Alert / Calculated Column only — not Layout Row Summary or Cell Summary). Toolbar chips still use expressionEditorButtons.

The reducer receives currentValue as the computed input for that row (the aggregation's input expression, not necessarily a raw column cell). aggColumnId is set only when the input is a bare column ref. A name registered in both customStandardFunctions and this map is a dual name: NAME() is row-wise, NAME{…} is the aggregation. Extra constants are positional args; per-row logic is a custom scalar used as the input.

Every aggregation accepts GROUP_BY and WHERE. Further clauses are capabilities the definition declares: cumulative (accept CUMULATIVE([orderCol]) — a running value per row), weight (accept WEIGHT([col]), delivered as weightValue) and returnType (static result type for Calculated Column data type / type checks). Declared capabilities are picked up automatically by validation, the Expression Editor clause chips, the Cumulative editor and the Query Builder. extends is not supported for aggregations.

TypeScript
customAggregatedFunctions?: Record<string, AggregatedExpressionFunction> | ((context: GlobalExpressionFunctionsContext<string>) => Record<string, AggregatedExpressionFunction>);
Default Value

undefined (none)

Property Value

Record<string,AggregatedExpressionFunction> | ((context:GlobalExpressionFunctionsContext<string>) => Record<string,AggregatedExpressionFunction>)

customStandardFunctions

Bespoke Standard Expression Functions — to complement those provided by AdapTable. “Standard” matches the Expression Editor (vs Aggregated).

Registers both value-producing functions and boolean predicates. A custom function is treated as a boolean predicate (usable as a filter or alert condition) only when it declares returnType: 'boolean' — predicates MUST set that property. returnType is required; use a value from EXPRESSION_RETURN_TYPES ('boolean' | 'number' | 'string' | 'date' | 'object' | 'null' | 'any').

Set category to a value from EXPRESSION_CATEGORIES (e.g. 'date', 'general', 'custom') so the function appears in the matching Expression Editor menu. Omit category (or use 'custom') for the Custom menu; any other string creates a menu with that name.

Entries are flat objects combining the AQL evaluation props (handler, returnType, operands, docs) with the Adaptable presentation / availability props (label, icon, isAvailable, …) — see AdaptableCustomExpressionFunction. Alternatively an entry may be an AdaptableCustomExpressionFunctionWithExtends partial that inherits metadata from a system (or previously registered custom) function via extends — useful when overriding a system operator such as IS_BLANK while keeping its label / icon / operands.

Boolean predicates stay Expression-Editor-only unless they declare returnType: 'boolean' and operands with arity 1 or 2 (column-only, or column + value). Optional label is used in the operator picker. operands of arity 0 / 3+ do not appear in Query Builder / ColumnFilter.

Toolbar chips are separate: use expressionEditorButtons (same as for system functions).

TypeScript
customStandardFunctions?: Record<string, AdaptableCustomExpressionFunctionEntry> | ((context: GlobalExpressionFunctionsContext<ScalarFunctionName>) => Record<string, AdaptableCustomExpressionFunctionEntry>);
Default Value

undefined (none)

Property Value

Record<string,AdaptableCustomExpressionFunctionEntry> | ((context:GlobalExpressionFunctionsContext<ScalarFunctionName>) => Record<string,AdaptableCustomExpressionFunctionEntry>)

displayColumnFriendlyNamesForExpressions

Reference a Column's Header (i.e. FriendlyName) in all Expression overviews (instead of ColumnId)

TypeScript
displayColumnFriendlyNamesForExpressions?: boolean;
Default Value

true

Property Value

boolean

editorOptions

Which UI editors are available for Boolean Expressions, and which opens first

TypeScript
editorOptions?: ExpressionEditorOptions;
Property Value

ExpressionEditorOptions

evaluateAdaptableQLExternally

Whether a Module (or specific expression) should be evaluated by AdaptableQL

TypeScript
evaluateAdaptableQLExternally?: (context: EvaluateExpressionExternallyContext<TData>) => boolean;
Default Value

All Modules are evaluated by AdapTable

Property Value

(context:EvaluateExpressionExternallyContext<TData>) => boolean

evaluateDatesUsingTime

Whether date comparisons use the full timestamp (exact instant) rather than the calendar day.

Affects the IN operator on date columns wherever Expressions are evaluated (Queries, Styled Columns, Alerts, Column Filters, ...): true compares the exact datetime, false compares the calendar day. Also controls whether the date Column Filter's distinct-value tree drills down to individual times. When an IN right-hand value is an ISO string containing T, the exact instant is used regardless.

TypeScript
evaluateDatesUsingTime?: boolean | ((context: AdaptableColumnContext) => boolean);
Default Value

false

Property Value

boolean | ((context:AdaptableColumnContext) => boolean)

expressionEditorButtons

Customise the function/operator chips shown above the Expression Editor.

Called per editor surface with AdapTable's defaultButtons for that type. Return those unchanged to keep defaults, or amend/replace them (useful when adding chips for customStandardFunctions / customAggregatedFunctions).

Editor types are intentionally coarse (e.g. standard covers both boolean and scalar editors; aggregated covers aggregated scalar and aggregated boolean) so callers are not forced to treat those as separate concepts.

Only chips whose function is available for the current Module are rendered.

TypeScript
expressionEditorButtons?: (context: ExpressionEditorButtonsContext) => ExpressionEditorButton[];
Default Value

undefined (use AdapTable defaults for each editor type)

Property Value

(context:ExpressionEditorButtonsContext) =>ExpressionEditorButton[]

fields

Fields are items in Data Source that are NOT columns but can be used in Expressions (via FIELD keyword)

TypeScript
fields?: AdaptableField[] | ((context: AdaptableFieldContext) => AdaptableField[]);
Property Value

AdaptableField[] | ((context:AdaptableFieldContext) =>AdaptableField[])

isColumnQueryable

Can a given column be included in Expressions

TypeScript
isColumnQueryable?: (queryableColumnContext: QueryableColumnContext) => boolean;
Default Value

undefined (all columns can be used in Expressions)

Property Value

(queryableColumnContext:QueryableColumnContext) => boolean

isExpressionFunctionAvailable

Whether an Expression Function is available in a given Module (or Column).

Called for each Expression Function and Module combination; return true to make the function available or false to hide it. The context includes defaultAvailability (whether the function would be available by default), which can be returned to keep the standard behaviour.

For Column Filter operators the callback is additionally invoked per-Column with context.column (and context.columnScope) set, so a different operator set can be offered per Column. column is undefined for the module-level pass, so guard on it before applying per-Column logic.

Hiding a function never disables a symbol operator: hiding SUM removes SUM(…) but + still works (likewise = / EQ, > / GT, ? : / IF). Keyword operators (CONTAINS, IN, CASE, …) are hidden with their function.

Structural functions (COL, FIELD, QUERY, DATE, $SCOPE, NULL, VAR, TRUE, FALSE, AND, OR, NOT) cannot be hidden; returning false for them is ignored (and logs a warning).

TypeScript
isExpressionFunctionAvailable?: (context: GlobalExpressionFunctionAvailabilityContext) => boolean;
Default Value

undefined (all functions have their default availability)

Property Value

(context:GlobalExpressionFunctionAvailabilityContext) => boolean

liveRefreshIntervalMs

Repaint cadence (in milliseconds) for cells whose rules depend on the clock (NOW(), IS_PAST(), ROW_AGE{}) or on a sliding window (WITHIN(...)). 0 disables the live refresh — such cells only repaint on data changes.

TypeScript
liveRefreshIntervalMs?: number;
Default Value

1000

Property Value

number

maxHistoryPerCell

Ring-buffer capacity per cell for the observable functions (CHANGE_COUNT, NET_CHANGE, HIGHEST, PREVIOUS, …): how many changes of one cell are retained for LAST_N / cumulative reads. Also the LAST_N(n) ceiling.

TypeScript
maxHistoryPerCell?: number;
Default Value

1000

Property Value

number

maxTimeframeSize

Maximum time (in milliseconds) to hold a Data Change event in a trailing timeframe

TypeScript
maxTimeframeSize?: number;
Default Value

28800000 (~8 hours)

Property Value

number

performExpressionValidation

Validate Expressions before they can be run or saved

TypeScript
performExpressionValidation?: boolean;
Default Value

true

Property Value

boolean

queryVariables

Query variables that can be referenced in Expressions via VAR('name'). Each variable has a name, a static or resolver value, and an optional description. Evaluated synchronously with each expression evaluation.

TypeScript
queryVariables?: QueryVariable[];
Property Value

QueryVariable[]

supportedAstContractVersions

AST contract versions a ServerSideRowModel / remote evaluator accepts. Absent means v1 only (raw parse tree). Include 2 to receive normalized contract-v2 ASTs from expressionApi.getASTForExpression.

TypeScript
supportedAstContractVersions?: number[];
Property Value

number[]