ExpressionApi

View as Markdown

Functions related to Expressions in AdapTableQL (the Adaptable Query Language)

TypeScript
export interface

Methods

MethodReturnsDescription
evaluateAggregatedExpression(request)ExpressionEvaluationResult<AggregatedExpressionEvaluationValue>Evaluates an Aggregation Expression (e.g. SUM{[price]},
MAX{[price], GROUP_BY([make])}, RANK{OVER([price])}, SUM{[price]} > 1000)
and returns a materialized snapshot: the global value, per-group values
(for GROUP_BY) and a per-row projection (getValueForRow).

When the Expression is a condition, matches is whether at least one
aggregation group satisfies it.

Default target is all loaded grid rows. Pass dataSet to aggregate a
caller-supplied array, or rowScope / rowFilter to narrow the grid
set. The snapshot does not update on data changes — re-evaluate when needed.

Under the server-side row model only currently loaded rows are aggregated;
inspect rowCount to detect partial data.
evaluateStandardExpression(request)ExpressionEvaluationResult<unknown>Evaluates a Standard Expression against a row.
Requires a row target (rowNode, primaryKeyValue, or data) on the request.
Never throws — returns a result envelope with success / errorMessage.

The Expression decides the return value: a condition such as [price] > 100
yields true / false; [price] * 1.19 yields a number.

Direct API evaluation ignores expressionOptions.evaluateAdaptableQLExternally
(that option only skips evaluation inside AdapTable features).
filterDataSet(request)ExpressionEvaluationResult<Record<string, unknown>[]>Returns the subset of dataSet matching a boolean Expression, in original
order and with the same object references. Validation runs once; a
per-row evaluation error fails the whole call.
filterRowNodes(request)ExpressionEvaluationResult<IRowNode[]>Returns the grid rows matching a boolean Expression, scoped by rowScope
and optionally pre-narrowed by rowFilter. Validation runs once; a
per-row evaluation error fails the whole call. Matching IRowNodes are
returned in source order.
getASTForExpression(expression)anyAST for remote / SSRM evaluation. Emits a normalized contract-v2 tree
when expressionOptions.supportedAstContractVersions includes 2;
otherwise the raw parse tree (v1).
getColumnsFromExpression(expression)string[]Returns all Columns referenced in an Expression
getExpressionKind(expression, module)ExpressionKindInfers the kind of an Expression from its text: aggregated when it contains an
aggregation (e.g. SUM{[col]}), scalar otherwise — observable reads such as
CHANGE_COUNT{[col], WITHIN(5m)} are scalar. Empty or unparseable text yields scalar.
getExpressionWithColumnFriendlyNames(expression)string | undefinedReturns the Expression with Column Headers in place of Column IDs
isColumnQueryable(abColumn)booleanWhether a column can be used in an AdapTableQL expression.
isValidAggregatedExpression(expression, module, validationErrorMessage)booleanWhether the given AggregatedExpression is valid
isValidScalarExpression(expression, module, validationErrorMessage)booleanWhether the given Expression is valid as a boolean predicate (Alert / Format Column /
Grid Filter / etc.). Root QUERY("x") is accepted only when the named query's
declared ReturnType is boolean (or absent).
isValidValueExpression(expression, module, validationErrorMessage)booleanWhether the given Expression is a valid value-producing scalar expression
(any return type — used by Calculated Column and non-boolean Named Queries).
migratePreV24Expression(expression, options)\{ expression: string; changed: boolean; error?: string; \}Convert a leftover (pre-v24) AdaptableQL string to the v24 greenfield
syntax. Unparseable input is returned unchanged with error set.

v24 introduced brace aggregations (SUM{[price]}), named operands
(CUMULATIVE([d]), WITHIN(5m)), and dropped wrappers such as
CUMUL(...) and TIMEFRAME(...). Persisted state is rewritten on
load by VersionUpgrade24 when autoMigrateState is on. Use this for
a single programmatic / external-config string that has not gone
through that upgrade. The runtime does not accept leftover spellings.

expressionKind is the stored module kind. Required for dual-name
paren calls (SUM([x]) scalar vs aggregation). Omit only when the
leftover is shape-proven (GROUP_BY / CUMUL / TIMEFRAME / …).
shouldEvaluateDatesUsingTime(column)booleanWhether date comparisons use the full timestamp (exact instant) rather than
the calendar day for the given column — governs the IN operator on date
columns and the date Column Filter's distinct-value tree granularity.
useCaseSensitivity()booleanWhether Expressions are evaluated using Case Sensitivity

Method Details

evaluateAggregatedExpression

Evaluates an Aggregation Expression (e.g. SUM{[price]}, MAX{[price], GROUP_BY([make])}, RANK{OVER([price])}, SUM{[price]} > 1000) and returns a materialized snapshot: the global value, per-group values (for GROUP_BY) and a per-row projection (getValueForRow).

When the Expression is a condition, matches is whether at least one aggregation group satisfies it.

Default target is all loaded grid rows. Pass dataSet to aggregate a caller-supplied array, or rowScope / rowFilter to narrow the grid set. The snapshot does not update on data changes — re-evaluate when needed.

Under the server-side row model only currently loaded rows are aggregated; inspect rowCount to detect partial data.

TypeScript
evaluateAggregatedExpression(request: EvaluateAggregatedExpressionRequest): ExpressionEvaluationResult<AggregatedExpressionEvaluationValue>;
Parameters
ParameterTypeDescription
requestEvaluateAggregatedExpressionRequestExpression + optional module / dataSet / rowScope / rowFilter
Returns

Evaluates an Aggregation Expression (e.g. SUM{[price]}, MAX{[price], GROUP_BY([make])}, RANK{OVER([price])}, SUM{[price]} > 1000) and returns a materialized snapshot: the global value, per-group values (for GROUP_BY) and a per-row projection (getValueForRow). When the Expression is a condition, matches is whether at least one aggregation group satisfies it. Default target is all loaded grid rows. Pass dataSet to aggregate a caller-supplied array, or rowScope / rowFilter to narrow the grid set. The snapshot does not update on data changes — re-evaluate when needed. Under the server-side row model only currently loaded rows are aggregated; inspect rowCount to detect partial data

ExpressionEvaluationResult<AggregatedExpressionEvaluationValue>

evaluateStandardExpression

Evaluates a Standard Expression against a row. Requires a row target (rowNode, primaryKeyValue, or data) on the request. Never throws — returns a result envelope with success / errorMessage.

The Expression decides the return value: a condition such as [price] > 100 yields true / false; [price] * 1.19 yields a number.

Direct API evaluation ignores expressionOptions.evaluateAdaptableQLExternally (that option only skips evaluation inside AdapTable features).

TypeScript
evaluateStandardExpression(request: EvaluateStandardExpressionRequest): ExpressionEvaluationResult<unknown>;
Parameters
ParameterTypeDescription
requestEvaluateStandardExpressionRequestExpression + exactly one row target (rowNode / primaryKeyValue / data)
Returns

Evaluates a Standard Expression against a row. Requires a row target (rowNode, primaryKeyValue, or data) on the request. Never throws — returns a result envelope with success / errorMessage. The Expression decides the return value: a condition such as [price] > 100 yields true / false; [price] * 1.19 yields a number. Direct API evaluation ignores expressionOptions.evaluateAdaptableQLExternally (that option only skips evaluation inside AdapTable features)

ExpressionEvaluationResult<unknown>

filterDataSet

Returns the subset of dataSet matching a boolean Expression, in original order and with the same object references. Validation runs once; a per-row evaluation error fails the whole call.

TypeScript
filterDataSet(request: FilterDataSetRequest): ExpressionEvaluationResult<Record<string, unknown>[]>;
Parameters
ParameterTypeDescription
requestFilterDataSetRequestExpression + the array to filter
Returns

The subset of dataSet matching a boolean Expression, in original order and with the same object references. Validation runs once; a per-row evaluation error fails the whole call

ExpressionEvaluationResult<Record<string, unknown>[]>

filterRowNodes

Returns the grid rows matching a boolean Expression, scoped by rowScope and optionally pre-narrowed by rowFilter. Validation runs once; a per-row evaluation error fails the whole call. Matching IRowNodes are returned in source order.

TypeScript
filterRowNodes(request: FilterRowNodesRequest): ExpressionEvaluationResult<IRowNode[]>;
Parameters
ParameterTypeDescription
requestFilterRowNodesRequestExpression + optional rowScope / rowFilter / cellValueOverride / module
Returns

The grid rows matching a boolean Expression, scoped by rowScope and optionally pre-narrowed by rowFilter. Validation runs once; a per-row evaluation error fails the whole call. Matching IRowNodes are returned in source order

ExpressionEvaluationResult<IRowNode[]>

getASTForExpression

AST for remote / SSRM evaluation. Emits a normalized contract-v2 tree when expressionOptions.supportedAstContractVersions includes 2; otherwise the raw parse tree (v1).

TypeScript
getASTForExpression(expression: string): any;
Parameters
ParameterTypeDescription
expressionstringExpression to parse
Returns

AST for remote / SSRM evaluation. Emits a normalized contract-v2 tree when expressionOptions.supportedAstContractVersions includes 2; otherwise the raw parse tree (v1)

any

getColumnsFromExpression

Returns all Columns referenced in an Expression

TypeScript
getColumnsFromExpression(expression: string): string[];
Parameters
ParameterTypeDescription
expressionstringexpression to check
Returns

All Columns referenced in an Expression

string[]

getExpressionKind

Infers the kind of an Expression from its text: aggregated when it contains an aggregation (e.g. SUM{[col]}), scalar otherwise — observable reads such as CHANGE_COUNT{[col], WITHIN(5m)} are scalar. Empty or unparseable text yields scalar.

TypeScript
getExpressionKind(expression: string, module?: AdaptableModule): ExpressionKind;
Parameters
ParameterTypeDescription
expressionstringthe AdaptableQL Expression
moduleAdaptableModulemodule whose custom functions are taken into account (default 'Expression')
Returns

Infers the kind of an Expression from its text: aggregated when it contains an aggregation (e.g. SUM{[col]}), scalar otherwise — observable reads such as CHANGE_COUNT{[col], WITHIN(5m)} are scalar. Empty or unparseable text yields scalar

ExpressionKind

getExpressionWithColumnFriendlyNames

Returns the Expression with Column Headers in place of Column IDs

TypeScript
getExpressionWithColumnFriendlyNames(expression: string | undefined | null): string | undefined;
Parameters
ParameterTypeDescription
expressionstring | undefined | nullthe Expression string
Returns

The Expression with Column Headers in place of Column IDs

string | undefined

isColumnQueryable

Whether a column can be used in an AdapTableQL expression.

TypeScript
isColumnQueryable(abColumn: AdaptableColumn): boolean;
Parameters
ParameterTypeDescription
abColumnAdaptableColumnColumn to check
Returns

true when a column can be used in an AdapTableQL expression

boolean

isValidAggregatedExpression

Whether the given AggregatedExpression is valid

TypeScript
isValidAggregatedExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;
Parameters
ParameterTypeDescription
expressionstringAggregatedExpression to check
moduleAdaptableModulemodule specific query
validationErrorMessagestringoptional validation error message; if provided, the error will be logged
Returns

true when the given AggregatedExpression is valid

boolean

isValidScalarExpression

Whether the given Expression is valid as a boolean predicate (Alert / Format Column / Grid Filter / etc.). Root QUERY("x") is accepted only when the named query's declared ReturnType is boolean (or absent).

TypeScript
isValidScalarExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;
Parameters
ParameterTypeDescription
expressionstringquery to Check
moduleAdaptableModulemodule specific query
validationErrorMessagestringoptional validation error message; if provided, the error will be logged
Returns

true when the given Expression is valid as a boolean predicate (Alert / Format Column / Grid Filter / etc.). Root QUERY("x") is accepted only when the named query's declared ReturnType is boolean (or absent)

boolean

isValidValueExpression

Whether the given Expression is a valid value-producing scalar expression (any return type — used by Calculated Column and non-boolean Named Queries).

TypeScript
isValidValueExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;
Parameters
ParameterTypeDescription
expressionstringExpression to check
moduleAdaptableModuleModule the expression belongs to
validationErrorMessagestringWhen set, the validation error is logged with this message
Returns

true when the given Expression is a valid value-producing scalar expression (any return type — used by Calculated Column and non-boolean Named Queries)

boolean

migratePreV24Expression

Convert a leftover (pre-v24) AdaptableQL string to the v24 greenfield syntax. Unparseable input is returned unchanged with error set.

v24 introduced brace aggregations (SUM{[price]}), named operands (CUMULATIVE([d]), WITHIN(5m)), and dropped wrappers such as CUMUL(...) and TIMEFRAME(...). Persisted state is rewritten on load by VersionUpgrade24 when autoMigrateState is on. Use this for a single programmatic / external-config string that has not gone through that upgrade. The runtime does not accept leftover spellings.

expressionKind is the stored module kind. Required for dual-name paren calls (SUM([x]) scalar vs aggregation). Omit only when the leftover is shape-proven (GROUP_BY / CUMUL / TIMEFRAME / …).

TypeScript
migratePreV24Expression(expression: string, options?: {
        expressionKind?: 'boolean' | 'scalar' | 'aggregatedScalar' | 'aggregatedBoolean';
    }): {
        expression: string;
        changed: boolean;
        error?: string;
    };
Parameters
ParameterTypeDescription
expressionstringExpression written in the older syntax
options\{ expressionKind?: 'boolean' | 'scalar' | 'aggregatedScalar' | 'aggregatedBoolean'; \}expressionKind is the stored module kind. Required for calls such as SUM([x]) that can be either a scalar or an aggregation
Returns

Convert a leftover (pre-v24) AdaptableQL string to the v24 greenfield syntax. Unparseable input is returned unchanged with error set. v24 introduced brace aggregations (SUM{[price]}), named operands (CUMULATIVE([d]), WITHIN(5m)), and dropped wrappers such as CUMUL(...) and TIMEFRAME(...). Persisted state is rewritten on load by VersionUpgrade24 when autoMigrateState is on. Use this for a single programmatic / external-config string that has not gone through that upgrade. The runtime does not accept leftover spellings. expressionKind is the stored module kind. Required for dual-name paren calls (SUM([x]) scalar vs aggregation). Omit only when the leftover is shape-proven (GROUP_BY / CUMUL / TIMEFRAME / …)

\{ expression: string; changed: boolean; error?: string; \}

shouldEvaluateDatesUsingTime

Whether date comparisons use the full timestamp (exact instant) rather than the calendar day for the given column — governs the IN operator on date columns and the date Column Filter's distinct-value tree granularity.

TypeScript
shouldEvaluateDatesUsingTime(column: string | AdaptableColumn): boolean;
Parameters
ParameterTypeDescription
columnstring |AdaptableColumnColumn id or column to check
Returns

true when date comparisons use the full timestamp (exact instant) rather than the calendar day for the given column — governs the IN operator on date columns and the date Column Filter's distinct-value tree granularity

boolean

useCaseSensitivity

Whether Expressions are evaluated using Case Sensitivity

TypeScript
useCaseSensitivity(): boolean;
Returns

true when Expressions are evaluated using Case Sensitivity

boolean