ExpressionApi
Functions related to Expressions in AdapTableQL (the Adaptable Query Language)
export interfaceMethods
| Method | Returns | Description |
|---|---|---|
| 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 oneaggregation group satisfies it. Default target is all loaded grid rows. Pass dataSet to aggregate acaller-supplied array, or rowScope / rowFilter to narrow the gridset. 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] > 100yields 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 originalorder 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 rowScopeand optionally pre-narrowed by rowFilter. Validation runs once; aper-row evaluation error fails the whole call. Matching IRowNodes arereturned in source order. |
| getASTForExpression(expression) | any | AST 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) | ExpressionKind | Infers the kind of an Expression from its text: aggregated when it contains anaggregation (e.g. SUM{[col]}), scalar otherwise — observable reads such asCHANGE_COUNT{[col], WITHIN(5m)} are scalar. Empty or unparseable text yields scalar. |
| getExpressionWithColumnFriendlyNames(expression) | string | undefined | Returns the Expression with Column Headers in place of Column IDs |
| isColumnQueryable(abColumn) | boolean | Whether a column can be used in an AdapTableQL expression. |
| isValidAggregatedExpression(expression, module, validationErrorMessage) | boolean | Whether the given AggregatedExpression is valid |
| isValidScalarExpression(expression, module, validationErrorMessage) | boolean | 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'sdeclared ReturnType is boolean (or absent). |
| isValidValueExpression(expression, module, validationErrorMessage) | boolean | Whether 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 asCUMUL(...) and TIMEFRAME(...). Persisted state is rewritten onload by VersionUpgrade24 when autoMigrateState is on. Use this fora 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-nameparen calls ( SUM([x]) scalar vs aggregation). Omit only when theleftover is shape-proven ( GROUP_BY / CUMUL / TIMEFRAME / …). |
| shouldEvaluateDatesUsingTime(column) | boolean | Whether date comparisons use the full timestamp (exact instant) rather than the calendar day for the given column — governs the IN operator on datecolumns and the date Column Filter's distinct-value tree granularity. |
| useCaseSensitivity() | boolean | Whether 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.
evaluateAggregatedExpression(request: EvaluateAggregatedExpressionRequest): ExpressionEvaluationResult<AggregatedExpressionEvaluationValue>;Parameters
| Parameter | Type | Description |
|---|---|---|
| request | EvaluateAggregatedExpressionRequest | Expression + 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).
evaluateStandardExpression(request: EvaluateStandardExpressionRequest): ExpressionEvaluationResult<unknown>;Parameters
| Parameter | Type | Description |
|---|---|---|
| request | EvaluateStandardExpressionRequest | Expression + 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.
filterDataSet(request: FilterDataSetRequest): ExpressionEvaluationResult<Record<string, unknown>[]>;Parameters
| Parameter | Type | Description |
|---|---|---|
| request | FilterDataSetRequest | Expression + 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.
filterRowNodes(request: FilterRowNodesRequest): ExpressionEvaluationResult<IRowNode[]>;Parameters
| Parameter | Type | Description |
|---|---|---|
| request | FilterRowNodesRequest | Expression + 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).
getASTForExpression(expression: string): any;Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | Expression 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
getColumnsFromExpression(expression: string): string[];Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | expression 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.
getExpressionKind(expression: string, module?: AdaptableModule): ExpressionKind;Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | the AdaptableQL Expression |
| module | AdaptableModule | module 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
getExpressionWithColumnFriendlyNames
Returns the Expression with Column Headers in place of Column IDs
getExpressionWithColumnFriendlyNames(expression: string | undefined | null): string | undefined;Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | undefined | null | the 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.
isColumnQueryable(abColumn: AdaptableColumn): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| abColumn | AdaptableColumn | Column to check |
Returns
true when a column can be used in an AdapTableQL expression
boolean
isValidAggregatedExpression
Whether the given AggregatedExpression is valid
isValidAggregatedExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | AggregatedExpression to check |
| module | AdaptableModule | module specific query |
| validationErrorMessage | string | optional 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).
isValidScalarExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | query to Check |
| module | AdaptableModule | module specific query |
| validationErrorMessage | string | optional 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).
isValidValueExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | Expression to check |
| module | AdaptableModule | Module the expression belongs to |
| validationErrorMessage | string | When 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 / …).
migratePreV24Expression(expression: string, options?: {
expressionKind?: 'boolean' | 'scalar' | 'aggregatedScalar' | 'aggregatedBoolean';
}): {
expression: string;
changed: boolean;
error?: string;
};Parameters
| Parameter | Type | Description |
|---|---|---|
| expression | string | Expression 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.
shouldEvaluateDatesUsingTime(column: string | AdaptableColumn): boolean;Parameters
| Parameter | Type | Description |
|---|---|---|
| column | string |AdaptableColumn | Column 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
useCaseSensitivity(): boolean;Returns
true when Expressions are evaluated using Case Sensitivity
boolean