# ExpressionOptions

Canonical page: https://www.adaptabletools.com/docs/reference/expressionoptions

Options for managing Expressions in AdapTable&#39;s Query Language

```ts title="TypeScript"
export interface ExpressionOptions<TData = any> 
```

## Properties

| 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`. |   |

## Property Details

### caseSensitiveExpressions

Perform case-sensitive text comparisons when evaluating Expressions

```ts title="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&#39;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.

```ts title="TypeScript"
customAggregatedFunctions?: Record<string, AggregatedExpressionFunction> | ((context: GlobalExpressionFunctionsContext<string>) => Record<string, AggregatedExpressionFunction>);
```

###### Default Value

undefined (none)

###### Property Value

`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)`>)`

### 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` (&#39;boolean&#39; | &#39;number&#39; | &#39;string&#39; | &#39;date&#39; |
&#39;object&#39; | &#39;null&#39; | &#39;any&#39;).

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).

```ts title="TypeScript"
customStandardFunctions?: Record<string, AdaptableCustomExpressionFunctionEntry> | ((context: GlobalExpressionFunctionsContext<ScalarFunctionName>) => Record<string, AdaptableCustomExpressionFunctionEntry>);
```

###### Default Value

undefined (none)

###### Property Value

`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)`>)`

### displayColumnFriendlyNamesForExpressions

Reference a Column&#39;s Header (i.e. FriendlyName) in all Expression overviews (instead of ColumnId)

```ts title="TypeScript"
displayColumnFriendlyNamesForExpressions?: boolean;
```

###### Default Value

true

###### Property Value

`boolean`

### editorOptions

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

```ts title="TypeScript"
editorOptions?: ExpressionEditorOptions;
```

###### Property Value

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

### evaluateAdaptableQLExternally

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

```ts title="TypeScript"
evaluateAdaptableQLExternally?: (context: EvaluateExpressionExternallyContext<TData>) => boolean;
```

###### Default Value

All Modules are evaluated by AdapTable

###### Property Value

`(context: `[`EvaluateExpressionExternallyContext`](https://www.adaptabletools.com/docs/reference/evaluateexpressionexternallycontext.md)`<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&#39;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.

```ts title="TypeScript"
evaluateDatesUsingTime?: boolean | ((context: AdaptableColumnContext) => boolean);
```

###### Default Value

false

###### Property Value

`boolean | ((context: `[`AdaptableColumnContext`](https://www.adaptabletools.com/docs/reference/adaptablecolumncontext.md)`) => boolean)`

### expressionEditorButtons

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

Called per editor surface with AdapTable&#39;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.

```ts title="TypeScript"
expressionEditorButtons?: (context: ExpressionEditorButtonsContext) => ExpressionEditorButton[];
```

###### Default Value

undefined (use AdapTable defaults for each editor type)

###### Property Value

`(context: `[`ExpressionEditorButtonsContext`](https://www.adaptabletools.com/docs/reference/expressioneditorbuttonscontext.md)`) => `[`ExpressionEditorButton`](https://www.adaptabletools.com/docs/reference/expressioneditorbutton.md)`[]`

### fields

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

```ts title="TypeScript"
fields?: AdaptableField[] | ((context: AdaptableFieldContext) => AdaptableField[]);
```

###### Property Value

[`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)`[])`

### isColumnQueryable

Can a given column be included in Expressions

```ts title="TypeScript"
isColumnQueryable?: (queryableColumnContext: QueryableColumnContext) => boolean;
```

###### Default Value

undefined (all columns can be used in Expressions)

###### Property Value

`(queryableColumnContext: `[`QueryableColumnContext`](https://www.adaptabletools.com/docs/reference/queryablecolumncontext.md)`) => 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).

```ts title="TypeScript"
isExpressionFunctionAvailable?: (context: GlobalExpressionFunctionAvailabilityContext) => boolean;
```

###### Default Value

undefined (all functions have their default availability)

###### Property Value

`(context: `[`GlobalExpressionFunctionAvailabilityContext`](https://www.adaptabletools.com/docs/reference/globalexpressionfunctionavailabilitycontext.md)`) => 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.

```ts title="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.

```ts title="TypeScript"
maxHistoryPerCell?: number;
```

###### Default Value

1000

###### Property Value

`number`

### maxTimeframeSize

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

```ts title="TypeScript"
maxTimeframeSize?: number;
```

###### Default Value

28800000 (~8 hours)

###### Property Value

`number`

### performExpressionValidation

Validate Expressions before they can be run or saved

```ts title="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.

```ts title="TypeScript"
queryVariables?: QueryVariable[];
```

###### Property Value

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

### 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`.

```ts title="TypeScript"
supportedAstContractVersions?: number[];
```

###### Property Value

`number[]`
