# AdapTableQL Expression Technical Reference

Canonical page: https://www.adaptabletools.com/docs/technical-reference-expression

## Expression Options

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [caseSensitiveExpressions](https://www.adaptabletools.com/docs/reference/expressionoptions.md#casesensitiveexpressions) | `boolean` | Perform case-sensitive text comparisons when evaluating Expressions | false |
| [customAggregatedFunctions](https://www.adaptabletools.com/docs/reference/expressionoptions.md#customaggregatedfunctions) | `Record<string, `[`AggregatedExpressionFunction`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md)`> \| ((context: `[`GlobalExpressionFunctionsContext`](https://www.adaptabletools.com/docs/reference/globalexpressionfunctionscontext.md)`<string>) => Record<string, `[`AggregatedExpressionFunction`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md)`>)` | Bespoke Aggregated Expression Functions — to complement those provided by<br/>AdapTable (Calculated Column Aggregated / Alert Aggregated).<br/><br/>Omit `category` (or set `'Aggregation'`) to list under the Aggregation<br/>Functions-menu section; any other string creates a section with that name.<br/>Use `isAvailable` with  to limit<br/>modules (Alert / Calculated Column only — not Layout Row Summary or Cell<br/>Summary). Toolbar chips still use `expressionEditorButtons`.<br/><br/>The reducer receives `currentValue` as the **computed input** for that<br/>row (the aggregation&#39;s input expression, not necessarily a raw column<br/>cell). `aggColumnId` is set only when the input is a bare column ref.<br/>A name registered in both `customStandardFunctions` and this map is a<br/>dual name: `NAME()` is row-wise, `NAME{…}` is the aggregation.<br/>Extra constants are positional `args`; per-row logic is a custom<br/>scalar used as the input.<br/><br/>Every aggregation accepts `GROUP_BY` and `WHERE`. Further clauses are<br/>capabilities the definition declares: `cumulative` (accept<br/>`CUMULATIVE([orderCol])` — a running value per row), `weight` (accept<br/>`WEIGHT([col])`, delivered as `weightValue`) and `returnType` (static<br/>result type for Calculated Column data type / type checks). Declared<br/>capabilities are picked up automatically by validation, the Expression<br/>Editor clause chips, the Cumulative editor and the Query Builder.<br/>`extends` is not supported for aggregations. | undefined (none) |
| [customStandardFunctions](https://www.adaptabletools.com/docs/reference/expressionoptions.md#customstandardfunctions) | `Record<string, `[`AdaptableCustomExpressionFunctionEntry`](https://www.adaptabletools.com/docs/reference/adaptablecustomexpressionfunctionentry.md)`> \| ((context: `[`GlobalExpressionFunctionsContext`](https://www.adaptabletools.com/docs/reference/globalexpressionfunctionscontext.md)`<ScalarFunctionName>) => Record<string, `[`AdaptableCustomExpressionFunctionEntry`](https://www.adaptabletools.com/docs/reference/adaptablecustomexpressionfunctionentry.md)`>)` | Bespoke Standard Expression Functions — to complement those provided by<br/>AdapTable. “Standard” matches the Expression Editor (vs Aggregated).<br/><br/>Registers both value-producing functions and boolean predicates. A custom<br/>function is treated as a boolean predicate (usable as a filter or alert<br/>condition) **only** when it declares `returnType: 'boolean'` — predicates<br/>MUST set that property. `returnType` is required; use a value from<br/>`EXPRESSION_RETURN_TYPES` (&#39;boolean&#39; \| &#39;number&#39; \| &#39;string&#39; \| &#39;date&#39; \|<br/>&#39;object&#39; \| &#39;null&#39; \| &#39;any&#39;).<br/><br/>Set `category` to a value from `EXPRESSION_CATEGORIES` (e.g. `'date'`,<br/>`'general'`, `'custom'`) so the function appears in the matching Expression<br/>Editor menu. Omit `category` (or use `'custom'`) for the Custom menu; any<br/>other string creates a menu with that name.<br/><br/>Entries are **flat** objects combining the AQL evaluation props<br/>(`handler`, `returnType`, `operands`, docs) with the Adaptable<br/>presentation / availability props (`label`, `icon`, `isAvailable`, …) —<br/>see `AdaptableCustomExpressionFunction`. Alternatively an entry may be<br/>an `AdaptableCustomExpressionFunctionWithExtends` partial that inherits<br/>metadata from a system (or previously registered custom) function via<br/>`extends` — useful when overriding a system operator such as `IS_BLANK`<br/>while keeping its label / icon / operands.<br/><br/>Boolean predicates stay Expression-Editor-only unless they declare<br/>`returnType: 'boolean'` and `operands` with arity 1 or 2 (column-only, or<br/>column + value). Optional `label` is used in the operator picker.<br/>`operands` of arity 0 / 3+ do not appear in Query Builder / ColumnFilter.<br/><br/>Toolbar chips are separate: use `expressionEditorButtons` (same as for<br/>system functions). | undefined (none) |
| [displayColumnFriendlyNamesForExpressions](https://www.adaptabletools.com/docs/reference/expressionoptions.md#displaycolumnfriendlynamesforexpressions) | `boolean` | Reference a Column&#39;s Header (i.e. FriendlyName) in all Expression overviews (instead of ColumnId) | true |
| [editorOptions](https://www.adaptabletools.com/docs/reference/expressionoptions.md#editoroptions) | [`ExpressionEditorOptions`](https://www.adaptabletools.com/docs/reference/expressioneditoroptions.md) | Which UI editors are available for Boolean Expressions, and which opens first |   |
| [evaluateAdaptableQLExternally](https://www.adaptabletools.com/docs/reference/expressionoptions.md#evaluateadaptableqlexternally) | `(context: `[`EvaluateExpressionExternallyContext`](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md)`<TData>) => boolean` | Whether a Module (or specific expression) should be evaluated by AdaptableQL | All Modules are evaluated by AdapTable |
| [evaluateDatesUsingTime](https://www.adaptabletools.com/docs/reference/expressionoptions.md#evaluatedatesusingtime) | `boolean \| ((context: `[`AdaptableColumnContext`](https://www.adaptabletools.com/docs/reference/adaptablecolumncontext.md)`) => boolean)` | Whether date comparisons use the full timestamp (exact instant) rather than the calendar day.<br/><br/>Affects the `IN` operator on date columns wherever Expressions are evaluated<br/>(Queries, Styled Columns, Alerts, Column Filters, ...): `true` compares the exact<br/>datetime, `false` compares the calendar day. Also controls whether the date Column<br/>Filter&#39;s distinct-value tree drills down to individual times.<br/>When an `IN` right-hand value is an ISO string containing `T`, the exact instant is used regardless. | false |
| [expressionEditorButtons](https://www.adaptabletools.com/docs/reference/expressionoptions.md#expressioneditorbuttons) | `(context: `[`ExpressionEditorButtonsContext`](https://www.adaptabletools.com/docs/reference/expressioneditorbuttonscontext.md)`) => `[`ExpressionEditorButton`](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md)`[]` | Customise the function/operator chips shown above the Expression Editor.<br/><br/>Called per editor surface with AdapTable&#39;s `defaultButtons` for that type.<br/>Return those unchanged to keep defaults, or amend/replace them (useful when<br/>adding chips for `customStandardFunctions` / `customAggregatedFunctions`).<br/><br/>Editor types are intentionally coarse (e.g. `standard` covers both boolean<br/>and scalar editors; `aggregated` covers aggregated scalar and aggregated<br/>boolean) so callers are not forced to treat those as separate concepts.<br/><br/>Only chips whose function is available for the current Module are rendered. | undefined (use AdapTable defaults for each editor type) |
| [fields](https://www.adaptabletools.com/docs/reference/expressionoptions.md#fields) | [`AdaptableField`](https://www.adaptabletools.com/docs/reference/adaptablefield.md)`[] \| ((context: `[`AdaptableFieldContext`](https://www.adaptabletools.com/docs/reference/adaptablefieldcontext.md)`) => `[`AdaptableField`](https://www.adaptabletools.com/docs/reference/adaptablefield.md)`[])` | Fields are items in Data Source that are NOT columns but can be used in Expressions (via FIELD keyword) |   |
| [isColumnQueryable](https://www.adaptabletools.com/docs/reference/expressionoptions.md#iscolumnqueryable) | `(queryableColumnContext: `[`QueryableColumnContext`](https://www.adaptabletools.com/docs/reference/queryablecolumncontext.md)`) => boolean` | Can a given column be included in Expressions | undefined (all columns can be used in Expressions) |
| [isExpressionFunctionAvailable](https://www.adaptabletools.com/docs/reference/expressionoptions.md#isexpressionfunctionavailable) | `(context: `[`GlobalExpressionFunctionAvailabilityContext`](https://www.adaptabletools.com/docs/reference/globalexpressionfunctionavailabilitycontext.md)`) => boolean` | Whether an Expression Function is available in a given Module (or Column).<br/><br/>Called for each Expression Function and Module combination; return `true`<br/>to make the function available or `false` to hide it. The context includes<br/>`defaultAvailability` (whether the function would be available by default),<br/>which can be returned to keep the standard behaviour.<br/><br/>For **Column Filter** operators the callback is additionally invoked<br/>per-Column with `context.column` (and `context.columnScope`) set, so a<br/>different operator set can be offered per Column. `column` is `undefined`<br/>for the module-level pass, so guard on it before applying per-Column logic.<br/><br/>Hiding a function never disables a symbol operator: hiding `SUM` removes<br/>`SUM(…)` but `+` still works (likewise `=` / `EQ`, `>` / `GT`, `? :` / `IF`).<br/>Keyword operators (`CONTAINS`, `IN`, `CASE`, …) are hidden with their function.<br/><br/>Structural functions (`COL`, `FIELD`, `QUERY`, `DATE`, `$SCOPE`, `NULL`,<br/>`VAR`, `TRUE`, `FALSE`, `AND`, `OR`, `NOT`) cannot be hidden; returning<br/>`false` for them is ignored (and logs a warning). | undefined (all functions have their default availability) |
| [liveRefreshIntervalMs](https://www.adaptabletools.com/docs/reference/expressionoptions.md#liverefreshintervalms) | `number` | Repaint cadence (in milliseconds) for cells whose rules depend on the clock<br/>(`NOW()`, `IS_PAST()`, `ROW_AGE{}`) or on a sliding window (`WITHIN(...)`).<br/>`0` disables the live refresh — such cells only repaint on data changes. | 1000 |
| [maxHistoryPerCell](https://www.adaptabletools.com/docs/reference/expressionoptions.md#maxhistorypercell) | `number` | Ring-buffer capacity per cell for the observable functions (`CHANGE_COUNT`,<br/>`NET_CHANGE`, `HIGHEST`, `PREVIOUS`, …): how many changes of one cell are<br/>retained for `LAST_N` / cumulative reads. Also the `LAST_N(n)` ceiling. | 1000 |
| [maxTimeframeSize](https://www.adaptabletools.com/docs/reference/expressionoptions.md#maxtimeframesize) | `number` | Maximum time (in milliseconds) to hold a Data Change event in a trailing timeframe | 28800000 (~8 hours) |
| [performExpressionValidation](https://www.adaptabletools.com/docs/reference/expressionoptions.md#performexpressionvalidation) | `boolean` | Validate Expressions before they can be run or saved | true |
| [queryVariables](https://www.adaptabletools.com/docs/reference/expressionoptions.md#queryvariables) | [`QueryVariable`](https://www.adaptabletools.com/docs/reference/queryvariable.md)`[]` | Query variables that can be referenced in Expressions via `VAR('name')`.<br/>Each variable has a name, a static or resolver value, and an optional description.<br/>Evaluated synchronously with each expression evaluation. |   |
| [supportedAstContractVersions](https://www.adaptabletools.com/docs/reference/expressionoptions.md#supportedastcontractversions) | `number[]` | AST contract versions a ServerSideRowModel / remote evaluator accepts.<br/>Absent means v1 only (raw parse tree). Include `2` to receive<br/>normalized contract-v2 ASTs from `expressionApi.getASTForExpression`. |   |

`customAggregatedFunctions` entries are an [`AggregatedExpressionFunction`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md):

| Property | Type | Description |
| --- | --- | --- |
| [category](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#category) | `string` | Freeform Functions-menu section for Alert Aggregated / Calculated Column<br/>Aggregated editors. Omit (or use `'Aggregation'`) to list under Aggregation;<br/>any other string becomes its own section label. |
| [cumulative](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#cumulative) | `boolean \| \{ currentValue: (context: `[`AggregatedExpressionCumulativeValueContext`](https://www.adaptabletools.com/docs/reference/aggregatedexpressioncumulativevaluecontext.md)`) => any; \}` | Accept a `CUMULATIVE([orderColumn])` clause, e.g.<br/>`MY_AGG{[notional], CUMULATIVE([tradeDate])}`.<br/><br/>- `true` — generic running variant: rows are visited in `CUMULATIVE`<br/> order (per `GROUP_BY` partition when grouped), `reducer` accumulates,<br/> and the value recorded for each row is `processAggregatedValue` (or<br/> the accumulator when absent) evaluated on the prefix so far.<br/>- object — override the per-row read with `currentValue` when<br/> `processAggregatedValue` is too expensive to run per row or the<br/> running value is not a function of the accumulator alone.<br/><br/>Declaring the capability also makes the clause known to validation, the<br/>Expression Editor clause chips / Cumulative editor and the Query Builder. |
| [description](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#description) | `string` | What the aggregation evaluates to (outcome), shown in editor<br/>documentation. Often starts with &quot;Returns …&quot;. |
| [examples](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#examples) | `string[]` | Examples to use the Aggregated Expression Function |
| [filterRow](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#filterrow) | `(context: `[`AggregatedExpressionFilterRowContext`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfilterrowcontext.md)`) => boolean` | Optional filter which is applied to each row before the reducer is called. If the filter returns false, the row is NOT included in the aggregation. |
| [initialValue](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#initialvalue) | `any` | Mandatory Initial Value for the aggregation.<br/><br/>May be a plain value or a factory function returning a fresh value.<br/>Use a factory when the reducer mutates its accumulator (objects, arrays,<br/>Maps, Sets) — plain object values are deep-cloned per aggregation run<br/>(and per group) for backward compatibility, which is slower. |
| [inputTypes](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#inputtypes) | `ExpressionFunctionInputType[]` | Optional argument types. |
| [isAvailable](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#isavailable) | [`AdaptableAggregatedExpressionModule`](https://www.adaptabletools.com/docs/reference/adaptableaggregatedexpressionmodule.md)`[] \| ((context: `[`ExpressionFunctionAvailabilityContext`](https://www.adaptabletools.com/docs/reference/expressionfunctionavailabilitycontext.md)`) => boolean)` | Where the function is available — same semantics as standard<br/>`isAvailable`, but restricted to <br/>(Alert Aggregated and Calculated Column Aggregated).<br/>`undefined` means both aggregated expression modules. |
| [prepareRowValue](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#preparerowvalue) | `(context: `[`AggregatedExpressionPrepareRowValueContext`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionpreparerowvaluecontext.md)`) => number \| string \| boolean \| Date \| undefined` | Called for each row AFTER the reducer() and processAggregatedValue() functions<br/>Can be used when each row has a different aggregated value (e.g. percentage = row value / aggregated value).<br/>Returns return value for each individual row (a boolean suits a boolean Calculated Column, e.g. &quot;is in the top K&quot;) |
| [processAggregatedValue](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#processaggregatedvalue) | `(context: `[`AggregatedExpressionProcessAggValueContext`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionprocessaggvaluecontext.md)`) => any` | Called AFTER the reducer() has processed all values / rows<br/>Can be used to change result of reducer based on the values array (e.g. average = aggregated value / count) |
| [reducer](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#reducer) | `(context: `[`AggregatedExpressionReducerContext`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionreducercontext.md)`) => any` | Mandatory Reducer function which is called for each value(row) in the Column Data |
| [returnType](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#returntype) | [`AggregatedExpressionReturnType`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionreturntype.md) | Static result type of the aggregation. Drives the Calculated Column data<br/>type, the outer expression type check and editor documentation.<br/>`'input'` = same type as the aggregated column (MIN / MAX style). When<br/>omitted the result type is unknown (Calculated Columns default to number). |
| [signatures](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#signatures) | `string[]` | Example Signatures for the Aggregated Expression Function |
| [weight](https://www.adaptabletools.com/docs/reference/aggregatedexpressionfunction.md#weight) | `boolean` | Accept a `WEIGHT([column])` clause, e.g.<br/>`MY_VWAP{[price], WEIGHT([quantity])}`. The resolved weight of the<br/>current row is delivered as `weightValue` on the `reducer`,<br/>`prepareRowValue` and `filterRow` contexts (and on the cumulative<br/>`currentValue` context). |

`editorOptions` is an [`ExpressionEditorOptions`](https://www.adaptabletools.com/docs/reference/expressioneditoroptions.md):

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [availableEditors](https://www.adaptabletools.com/docs/reference/expressioneditoroptions.md#availableeditors) | [`ExpressionEditors`](https://www.adaptabletools.com/docs/reference/expressioneditors.md) | Which UI editors can be used for Boolean Expressions (Query Builder, Expression Editor, or both).<br/>Takes precedence over `defaultEditor`: if only one editor is listed, that editor is shown<br/>and `defaultEditor` is not evaluated. | [&#39;QueryBuilder&#39;, &#39;ExpressionEditor&#39;] |
| [defaultColumnView](https://www.adaptabletools.com/docs/reference/expressioneditoroptions.md#defaultcolumnview) | [`ExpressionEditorColumnView`](https://www.adaptabletools.com/docs/reference/expressioneditorcolumnview.md) | Initial Columns/Fields panel layout in the Expression Editor.<br/>- `collapsed` — column names only (more room for the editor)<br/>- `expanded` — names plus sample/test value inputs | &#39;collapsed&#39; |
| [defaultEditor](https://www.adaptabletools.com/docs/reference/expressioneditoroptions.md#defaulteditor) | [`ExpressionEditorKind`](https://www.adaptabletools.com/docs/reference/expressioneditorkind.md)` \| ((context: `[`DefaultExpressionEditorContext`](https://www.adaptabletools.com/docs/reference/defaultexpressioneditorcontext.md)`) => `[`ExpressionEditorKind`](https://www.adaptabletools.com/docs/reference/expressioneditorkind.md)`)` | Which editor to open first when more than one editor is available.<br/>Receives context (including Module) so the choice can vary by user or surface.<br/>Ignored when `availableEditors` contains a single item.<br/><br/>Overridden to `'ExpressionEditor'` when the current expression cannot be<br/>edited in the Query Builder (non-boolean / value-producing expressions,<br/>advanced constructs such as `QUERY` / `FIELD`, or expressions QB cannot<br/>parse). Empty / new expressions still honour this preference. | &#39;QueryBuilder&#39; |

`expressionEditorButtons` returns [`ExpressionEditorButton`](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md) objects and receives an [`ExpressionEditorButtonsContext`](https://www.adaptabletools.com/docs/reference/expressioneditorbuttonscontext.md):

| Property | Type | Description |
| --- | --- | --- |
| [data](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md#data) | `string` | Text inserted into the editor when the chip is clicked |
| [functionName](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md#functionname) | `string` | Registered Expression Function name. When set, the chip is only shown if<br/>that function exists in the editor&#39;s function map. Omit for plain-text<br/>inserts (e.g. `"INCREASE"` / `"DECREASE"`). |
| [icon](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md#icon) | `string` | Optional icon name (when set, typically shown instead of `text`) |
| [newRowAfter](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md#newrowafter) | `boolean` | When true, starts a new toolbar row after this chip |
| [text](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md#text) | `string` | Optional label shown on the chip |

| Property | Type | Description |
| --- | --- | --- |
| [defaultButtons](https://www.adaptabletools.com/docs/reference/expressioneditorbuttonscontext.md#defaultbuttons) | [`ExpressionEditorButton`](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md)`[]` | AdapTable&#39;s default buttons for this editor type |
| [editorType](https://www.adaptabletools.com/docs/reference/expressioneditorbuttonscontext.md#editortype) | [`ExpressionEditorType`](https://www.adaptabletools.com/docs/reference/expressioneditortype.md) | Coarse editor category: `scalar` \| `aggregated` \| `cumulative` \|<br/>`quantile` \| `window` \| `observable` (the Observable Calculated Column<br/>editor — hosts that add chips to `scalar` usually want them here too) |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/expressioneditorbuttonscontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

`fields` entries are an [`AdaptableField`](https://www.adaptabletools.com/docs/reference/adaptablefield.md):

| Property | Type | Description |
| --- | --- | --- |
| [dataType](https://www.adaptabletools.com/docs/reference/adaptablefield.md#datatype) | [`AdaptableColumnDataType`](https://www.adaptabletools.com/docs/reference/adaptablecolumndatatype.md) | Data Type of field, used to validate and show correctly in UI |
| [label](https://www.adaptabletools.com/docs/reference/adaptablefield.md#label) | `string` | Label for field (optional - defaults to name) |
| [name](https://www.adaptabletools.com/docs/reference/adaptablefield.md#name) | `string` | Name of field in data source, e.g. &#39;rowId&#39;, &#39;parentObject.childObject.value&#39; |

`queryVariables` entries are a [`QueryVariable`](https://www.adaptabletools.com/docs/reference/queryvariable.md):

| Property | Type | Description |
| --- | --- | --- |
| [description](https://www.adaptabletools.com/docs/reference/queryvariable.md#description) | `string` | Optional description shown in the Expression Editor lookups |
| [name](https://www.adaptabletools.com/docs/reference/queryvariable.md#name) | `string` | Unique name used to reference the variable in expressions: `VAR('name')` |
| [value](https://www.adaptabletools.com/docs/reference/queryvariable.md#value) | [`QueryVariableValue`](https://www.adaptabletools.com/docs/reference/queryvariablevalue.md)` \| ((context: `[`QueryVariableContext`](https://www.adaptabletools.com/docs/reference/queryvariablecontext.md)`) => `[`QueryVariableValue`](https://www.adaptabletools.com/docs/reference/queryvariablevalue.md)`)` | Static value, or resolver evaluated with each expression evaluation |

`evaluateAdaptableQLExternally` receives an [`EvaluateExpressionExternallyContext`](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md):

| Property | Type | Description |
| --- | --- | --- |
| [expression](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md#expression) | `string` | Expression to evaluate |
| [module](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md#module) | [`AdaptableQLModule`](https://www.adaptabletools.com/docs/reference/adaptableqlmodule.md) | Module being evaluated: Alert, CalculatedColumn, ColumnFilter, GridFilter |
| [object](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md#object) | [`AdaptableObject`](https://www.adaptabletools.com/docs/reference/adaptableobject.md) | AdapTable Object which contains the Expression |
| [referencedColumns](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md#referencedcolumns) | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md)`<TData>[]` | Columns contained in Expression |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

`isColumnQueryable` receives a [`QueryableColumnContext`](https://www.adaptabletools.com/docs/reference/queryablecolumncontext.md):

| Property | Type | Description |
| --- | --- | --- |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/queryablecolumncontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

`isExpressionFunctionAvailable` receives a [`GlobalExpressionFunctionAvailabilityContext`](https://www.adaptabletools.com/docs/reference/globalexpressionfunctionavailabilitycontext.md):

| Property | Type | Description |
| --- | --- | --- |
| [defaultAvailability](https://www.adaptabletools.com/docs/reference/globalexpressionfunctionavailabilitycontext.md#defaultavailability) | `boolean` | Whether the Expression Function would be available by default;<br/>return this value to keep the standard behaviour |
| [adaptableContext](https://www.adaptabletools.com/docs/reference/globalexpressionfunctionavailabilitycontext.md#adaptablecontext) | `any` | Custom application Context provided in `AdaptableOptions.adaptableContext` |

----

## Expression API

| Method | Returns | Description |
| --- | --- | --- |
| [evaluateAggregatedExpression(request)](https://www.adaptabletools.com/docs/reference/expressionapi.md#evaluateaggregatedexpression) | [`ExpressionEvaluationResult`](https://www.adaptabletools.com/docs/reference/expressionevaluationresult.md)`<`[`AggregatedExpressionEvaluationValue`](https://www.adaptabletools.com/docs/reference/aggregatedexpressionevaluationvalue.md)`>` | Evaluates an Aggregation Expression (e.g. `SUM{[price]}`,<br/>`MAX{[price], GROUP_BY([make])}`, `RANK{OVER([price])}`, `SUM{[price]} > 1000`)<br/>and returns a materialized snapshot: the global value, per-group values<br/>(for `GROUP_BY`) and a per-row projection (`getValueForRow`).<br/><br/>When the Expression is a condition, `matches` is whether at least one<br/>aggregation group satisfies it.<br/><br/>Default target is all loaded grid rows. Pass `dataSet` to aggregate a<br/>caller-supplied array, or `rowScope` / `rowFilter` to narrow the grid<br/>set. The snapshot does not update on data changes — re-evaluate when needed.<br/><br/>Under the server-side row model only currently loaded rows are aggregated;<br/>inspect `rowCount` to detect partial data. |
| [evaluateStandardExpression(request)](https://www.adaptabletools.com/docs/reference/expressionapi.md#evaluatestandardexpression) | [`ExpressionEvaluationResult`](https://www.adaptabletools.com/docs/reference/expressionevaluationresult.md)`<unknown>` | Evaluates a Standard Expression against a row.<br/>Requires a row target (`rowNode`, `primaryKeyValue`, or `data`) on the request.<br/>Never throws — returns a result envelope with `success` / `errorMessage`.<br/><br/>The Expression decides the return value: a condition such as `[price] > 100`<br/>yields `true` / `false`; `[price] * 1.19` yields a number.<br/><br/>Direct API evaluation ignores `expressionOptions.evaluateAdaptableQLExternally`<br/>(that option only skips evaluation inside AdapTable features). |
| [filterDataSet(request)](https://www.adaptabletools.com/docs/reference/expressionapi.md#filterdataset) | [`ExpressionEvaluationResult`](https://www.adaptabletools.com/docs/reference/expressionevaluationresult.md)`<Record<string, unknown>[]>` | Returns the subset of `dataSet` matching a boolean Expression, in original<br/>order and with the same object references. Validation runs once; a<br/>per-row evaluation error fails the whole call. |
| [filterRowNodes(request)](https://www.adaptabletools.com/docs/reference/expressionapi.md#filterrownodes) | [`ExpressionEvaluationResult`](https://www.adaptabletools.com/docs/reference/expressionevaluationresult.md)`<IRowNode[]>` | Returns the grid rows matching a boolean Expression, scoped by `rowScope`<br/>and optionally pre-narrowed by `rowFilter`. Validation runs once; a<br/>per-row evaluation error fails the whole call. Matching `IRowNode`s are<br/>returned in source order. |
| [getASTForExpression(expression)](https://www.adaptabletools.com/docs/reference/expressionapi.md#getastforexpression) | `any` | AST for remote / SSRM evaluation. Emits a normalized contract-v2 tree<br/>when `expressionOptions.supportedAstContractVersions` includes `2`;<br/>otherwise the raw parse tree (v1). |
| [getColumnsFromExpression(expression)](https://www.adaptabletools.com/docs/reference/expressionapi.md#getcolumnsfromexpression) | `string[]` | Returns all Columns referenced in an Expression |
| [getExpressionKind(expression, module)](https://www.adaptabletools.com/docs/reference/expressionapi.md#getexpressionkind) | [`ExpressionKind`](https://www.adaptabletools.com/docs/reference/expressionkind.md) | Infers the kind of an Expression from its text: `aggregated` when it contains an<br/>aggregation (e.g. `SUM{[col]}`), `scalar` otherwise — observable reads such as<br/>`CHANGE_COUNT{[col], WITHIN(5m)}` are scalar. Empty or unparseable text yields `scalar`. |
| [getExpressionWithColumnFriendlyNames(expression)](https://www.adaptabletools.com/docs/reference/expressionapi.md#getexpressionwithcolumnfriendlynames) | `string \| undefined` | Returns the Expression with Column Headers in place of Column IDs |
| [isColumnQueryable(abColumn)](https://www.adaptabletools.com/docs/reference/expressionapi.md#iscolumnqueryable) | `boolean` | Whether a column can be used in an AdapTableQL expression. |
| [isValidAggregatedExpression(expression, module, validationErrorMessage)](https://www.adaptabletools.com/docs/reference/expressionapi.md#isvalidaggregatedexpression) | `boolean` | Whether the given AggregatedExpression is valid |
| [isValidScalarExpression(expression, module, validationErrorMessage)](https://www.adaptabletools.com/docs/reference/expressionapi.md#isvalidscalarexpression) | `boolean` | Whether the given Expression is valid as a boolean predicate (Alert / Format Column /<br/>Grid Filter / etc.). Root `QUERY("x")` is accepted only when the named query&#39;s<br/>declared ReturnType is boolean (or absent). |
| [isValidValueExpression(expression, module, validationErrorMessage)](https://www.adaptabletools.com/docs/reference/expressionapi.md#isvalidvalueexpression) | `boolean` | Whether the given Expression is a valid value-producing scalar expression<br/>(any return type — used by Calculated Column and non-boolean Named Queries). |
| [migratePreV24Expression(expression, options)](https://www.adaptabletools.com/docs/reference/expressionapi.md#migrateprev24expression) | `\{ expression: string; changed: boolean; error?: string; \}` | Convert a leftover (pre-v24) AdaptableQL string to the v24 greenfield<br/>syntax. Unparseable input is returned unchanged with `error` set.<br/><br/>v24 introduced brace aggregations (`SUM{[price]}`), named operands<br/>(`CUMULATIVE([d])`, `WITHIN(5m)`), and dropped wrappers such as<br/>`CUMUL(...)` and `TIMEFRAME(...)`. Persisted state is rewritten on<br/>load by VersionUpgrade24 when `autoMigrateState` is on. Use this for<br/>a single programmatic / external-config string that has not gone<br/>through that upgrade. The runtime does not accept leftover spellings.<br/><br/>`expressionKind` is the stored module kind. Required for dual-name<br/>paren calls (`SUM([x])` scalar vs aggregation). Omit only when the<br/>leftover is shape-proven (`GROUP_BY` / `CUMUL` / `TIMEFRAME` / …). |
| [shouldEvaluateDatesUsingTime(column)](https://www.adaptabletools.com/docs/reference/expressionapi.md#shouldevaluatedatesusingtime) | `boolean` | Whether date comparisons use the full timestamp (exact instant) rather than<br/>the calendar day for the given column — governs the `IN` operator on date<br/>columns and the date Column Filter&#39;s distinct-value tree granularity. |
| [useCaseSensitivity()](https://www.adaptabletools.com/docs/reference/expressionapi.md#usecasesensitivity) | `boolean` | Whether Expressions are evaluated using Case Sensitivity |

See [Evaluating Expressions via the API](https://www.adaptabletools.com/docs/adaptable-ql-expression-evaluation/index.md) for how to call `evaluateStandardExpression` / `evaluateAggregatedExpression` / `filter*`, including external data sets, row narrowing, what-if overrides and the SSRM partial-data caveat.
