---
product: "AG Studio"
title: "Expressions"
description: "Expressions generate new columns from the source data."
framework: react
version: "3.1.0"
related:
    - title: "Data Types"
      url: "https://www.ag-grid.com/studio/archive/3.1.0/react/data-types/"
    - title: "Formatting"
      url: "https://www.ag-grid.com/studio/archive/3.1.0/react/formatting/"
    - title: "Calendars"
      url: "https://www.ag-grid.com/studio/archive/3.1.0/react/calendars/"
    - title: "Editable Fields"
      url: "https://www.ag-grid.com/studio/archive/3.1.0/react/creating-editing-fields/"
llms: "https://www.ag-grid.com/studio/archive/3.1.0/llms.txt"
---

# Expressions

Expressions generate new columns from the source data.

```
const expressionFields = [
    {
        id: 'revenue',
        isMeasure: false,
        expression: {
            operator: 'multiply',
            inputs: [
                { id: 'sales.unitPrice' },
                { id: 'sales.quantity' },
            ],
        },
    },
];
```

Expression fields are defined on the [Data Source](https://www.ag-grid.com/studio/archive/3.1.0/react/data/) as an array of `AgExpressionFieldDefinition`s. Each expression field consists of an field definition (similar to a normal [Field Definition](https://www.ag-grid.com/studio/archive/3.1.0/react/loading-data/#fields)), along with the expression itself.

[See Below](https://www.ag-grid.com/studio/archive/3.1.0/react/expressions/#expression-field-definition) for the expression field API.

## Calculated Columns & Measures

An Expression Field can produce two different outputs:

1. **Calculated Column** - For example `Profit = Revenue - Cost`.
2. **Measure** - For example `Total Profit = SUM(Revenue - Cost)`.

Users can never edit an expression you define. The Field Panel shows a string expression read-only, and does not show an expression defined as an object. See [Developer-Defined Expressions](https://www.ag-grid.com/studio/archive/3.1.0/react/creating-editing-fields/#developer-defined-expressions).

### Calculated Columns

Calculated columns produce multiple outputs for multiple inputs, and can therefore be aggregated in the UI.

You must specify `isMeasure: false` for Calculated Columns.

#### Calculated Columns

```tsx
"use client";

import React, {
  useCallback,
  useMemo,
  useRef,
  useState,
  StrictMode,
} from "react";
import { createRoot } from "react-dom/client";
import { AgStudio, AgStudioRef } from "ag-studio-react";
import {
  AgDataEngine,
  AgDataSourcesDefinition,
  AgReportHistory,
  AgReportState,
  AgStudioApi,
  AgStudioMode,
  AgStudioProperties,
  enableStudioDevValidations,
} from "ag-studio";
import { getData } from "./data.tsx";

if (process.env.NODE_ENV !== "production") {
  // Enable extended validations only for development
  enableStudioDevValidations();
}

const StudioExample = () => {
  const containerStyle = useMemo(() => ({ width: "100%", height: "100%" }), []);
  const studioStyle = useMemo(() => ({ height: "100%", width: "100%" }), []);
  const [data, setData] = useState<AgDataSource>(getData());
  const initialState = useMemo<AgReportState | AgReportHistory>(() => {
    return {
      pages: [
        {
          id: "pageA",
          widgets: {
            "calculated-columns-grid": {
              type: "grid",
              dataMapping: {
                cols: [
                  { id: "fullName" },
                  { id: "revenue" },
                  { id: "sales.unitCost" },
                  { id: "profit" },
                  { id: "isPremiumProduct" },
                  { id: "daysSinceSale" },
                ],
              },
              sort: [
                {
                  field: { id: "profit" },
                  direction: "desc",
                },
              ],
              format: {
                title: {
                  enabled: true,
                  text: "Calculated Columns",
                },
              },
            },
          },
          widgetLayout: {
            "calculated-columns-grid": {
              xTrack: 0,
              yTrack: 0,
              xSpan: 24,
              ySpan: 25,
            },
          },
        },
      ],
      selectedPageId: "pageA",
      panels: {
        filters: {
          collapsed: true,
        },
        edit: {
          collapsed: true,
        },
      },
    };
  }, []);

  return (
    <div style={containerStyle}>
      <div style={{ display: "flex", flexDirection: "column", height: "100%" }}>
        <AgStudio
          style={studioStyle}
          className="my-studio-container"
          data={data}
          initialState={initialState}
          mode={"edit"}
        />
      </div>
    </div>
  );
};

const root = createRoot(document.getElementById("root")!);
root.render(
  <StrictMode>
    <StudioExample />
  </StrictMode>,
);
```

[Live example: Calculated Columns](https://www.ag-grid.com/studio/archive/3.1.0/examples/expressions/calculated-columns/reactFunctionalTs/)

```
const expressionFields = [
    {
        id: 'profit',
        isMeasure: false,
        expression: {
            operator: 'multiply',
            inputs: [
                {
                    operator: 'subtract',
                    inputs: [
                        { id: 'sales.unitPrice' },
                        { id: 'sales.unitCost' },
                    ],
                },
                { id: 'sales.quantity' },
            ],
        },
    },
    // ...
];
```

### Measures

Measures produce a single output from multiple inputs, so the UI cannot aggregate them further.

The [Total Row and Total Columns](https://www.ag-grid.com/studio/archive/3.1.0/analysts/table-widgets/#totals) calculate each Measure again over all the rows they cover, rather than adding up the values in the table. A Measure that returns a weighted average, for example, shows the weighted average of every row in the Total Row.

You must specify `isMeasure: true` for Measures.

#### Measure Columns

```tsx
"use client";

import React, {
  useCallback,
  useMemo,
  useRef,
  useState,
  StrictMode,
} from "react";
import { createRoot } from "react-dom/client";
import { AgStudio, AgStudioRef } from "ag-studio-react";
import {
  AgDataEngine,
  AgDataSourcesDefinition,
  AgReportHistory,
  AgReportState,
  AgStudioApi,
  AgStudioMode,
  AgStudioProperties,
  enableStudioDevValidations,
} from "ag-studio";
import { getData } from "./data.tsx";

if (process.env.NODE_ENV !== "production") {
  // Enable extended validations only for development
  enableStudioDevValidations();
}

const StudioExample = () => {
  const containerStyle = useMemo(() => ({ width: "100%", height: "100%" }), []);
  const studioStyle = useMemo(() => ({ height: "100%", width: "100%" }), []);
  const [data, setData] = useState<AgDataSource>(getData());
  const initialState = useMemo<AgReportState | AgReportHistory>(() => {
    return {
      pages: [
        {
          id: "pageA",
          widgets: {
            "measure-columns-grid": {
              type: "grid",
              dataMapping: {
                cols: [
                  { id: "sales.region" },
                  { id: "sales.product" },
                  { id: "totalProfit" },
                ],
              },
              sort: [
                {
                  field: { id: "totalProfit" },
                  direction: "desc",
                },
              ],
              format: {
                title: {
                  enabled: true,
                  text: "Measure Columns",
                },
              },
            },
          },
          widgetLayout: {
            "measure-columns-grid": {
              xTrack: 0,
              yTrack: 0,
              xSpan: 24,
              ySpan: 25,
            },
          },
        },
      ],
      selectedPageId: "pageA",
      panels: {
        filters: {
          collapsed: true,
        },
        edit: {
          collapsed: true,
        },
      },
    };
  }, []);

  return (
    <div style={containerStyle}>
      <div style={{ display: "flex", flexDirection: "column", height: "100%" }}>
        <AgStudio
          style={studioStyle}
          className="my-studio-container"
          data={data}
          initialState={initialState}
          mode={"edit"}
        />
      </div>
    </div>
  );
};

const root = createRoot(document.getElementById("root")!);
root.render(
  <StrictMode>
    <StudioExample />
  </StrictMode>,
);
```

[Live example: Measure Columns](https://www.ag-grid.com/studio/archive/3.1.0/examples/expressions/measure-columns/reactFunctionalTs/)

```
const expressionFields = [
    {
        id: 'totalProfit',
        isMeasure: true,
        expression: {
            operator: 'subtract',
            inputs: [
                { id: 'sales.unitPrice', aggregation: 'sum' },
                { id: 'sales.unitCost', aggregation: 'sum' },
            ],
        },
    },
    // ...
]
```

## Expression Types

An expression is of one of three types:

1. Function - A function applies an operator to one or more inputs.
2. Value - A value is a fixed value (e.g. number, string, etc.).
3. Field - A field refers to another field (either in the source data, or another expression field).

### Function Expression

```
const functionExpression = {
    operator: 'multiply',
    inputs: [
        { id: 'sales.unitPrice' },
        { value: 100 },
    ],
};
```

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `functionExpression` | `AgFunctionExpression` |  | A function expression applies an operator to one or more inputs. Each input is another expression - a function, value or field. |

[See Below](https://www.ag-grid.com/studio/archive/3.1.0/react/expressions/#function-expression-operators) for the list of function expression operators.

### Value Expression

```
const valueExpression = {
    type: 'number',
    value: 100,
};
```

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `valueExpression` | `AgValueExpression` |  | A value expression is a fixed value (e.g. number, string, etc.). |

### Field Expression

```
const fieldExpression = {
    id: 'sale.profit',
    aggregation: 'sum',
};
```

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `fieldExpression` | `AgFieldExpression` |  | A field expression refers to another field (either in the source data, or another expression field). |

## API

### Expression Field Definition

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `format` | `TFormat` |  | The format type of the field (provides default formatting, etc.). If not provided, will be inferred from the expression. |
| `isMeasure` | `boolean` |  | Whether this expression creates a Measure or a Calculated Column. A Calculated Column produces a list of values, e.g. quantity × cost, even without a grouping. A Measure produces a single value e.g. SUM(quantity). |
| `expression` | `string \| AgExpression<TRegistry>` |  | The expression for the field. |
| `id` | `string` |  | Field ID. |
| `name` | `string` |  | Display name. |
| `description` | `string` |  | Field description. Displayed in the Field Panel |
| `hide` | `boolean` |  | Set to `true` to hide from being selected in the UI. Field can still be used for joins. |
| `editable` | `boolean \| AgFieldEditableKey[]` |  | Controls whether the field can be edited in the UI. |
| `serializer` | `AgFieldSerializer<InferDataTypeFromFormat<TRegistry, TFormat>>` |  | Optional. How the field values will be serialized into state. Defaults to format serializer. |
| `deserializer` | `AgFieldDeserializer<InferDataTypeFromFormat<TRegistry, TFormat>>` |  | Optional. How the field values will be deserialized from state. Defaults to format deserializer. |
| `createValueFormatter` | `AgFieldValueFormatterFactory<InferDataTypeFromFormat<TRegistry, TFormat>, TFormatOptions, any>` |  | Optional. Build a value formatter bound to the field's format options and the runtime API. Defaults to format factory. |
| `blankValue` | `string` |  | Optional. How blank values will be displayed. Defaults to format blank value. |
| `formatOptions` | `TFormatOptions` |  | Optional. Will be passed to the value formatter. |
| `context` | `any` |  | Optional. An application-defined object carried on the hydrated field, and passed back on that field to callbacks such as a grid widget's `createCellRenderer`. Studio never reads it. Replaces any `context` set on the field's format. |

### Function Expression Operators

Each operator is listed under the name a [Function Expression](https://www.ag-grid.com/studio/archive/3.1.0/react/expressions/#function-expression) uses for `operator`. Its description opens with the equivalent [Typed Syntax](https://www.ag-grid.com/studio/archive/3.1.0/react/creating-editing-fields/#editing-expressions), then lists the input types the operator accepts and the type it returns. Function names are case-insensitive, and some operators also have an infix form.

| Property | Type | Default | Description |
| --- | --- | --- | --- |
| `add` | `AgFunctionExpression<TRegistry, "add">` |  | `ADD(a, b)`, or `a + b`. `a & b` concatenates strings. Add two values together. `['number', 'number'] => 'number'` `['string', 'string'] => 'string'` |
| `subtract` | `AgFunctionExpression<TRegistry, "subtract">` |  | `SUBTRACT(a, b)`, or `a - b`. Subtract the second value from the first. `['number', 'number'] => 'number'` |
| `multiply` | `AgFunctionExpression<TRegistry, "multiply">` |  | `MULTIPLY(a, b)`, or `a * b`. Multiply two values together. `['number', 'number'] => 'number'` |
| `divide` | `AgFunctionExpression<TRegistry, "divide">` |  | `DIVIDE(a, b)`, or `a / b`. Divide the first value by the second. `['number', 'number'] => 'number'` |
| `modulo` | `AgFunctionExpression<TRegistry, "modulo">` |  | `MODULO(a, b)`. Remainder of the first value divided by the second. `['number', 'number'] => 'number'` |
| `equals` | `AgFunctionExpression<TRegistry, "equals">` |  | `EQUALS(a, b)`, or `a = b`. Are the two values equal? `['number', 'number'] => 'boolean'` `['date', 'date'] => 'boolean'` `['datetime', 'datetime'] => 'boolean'` `['boolean', 'boolean'] => 'boolean'` `['string', 'string'] => 'boolean'` |
| `notEqual` | `AgFunctionExpression<TRegistry, "notEqual">` |  | `NOTEQUAL(a, b)`, or `a <> b`. Are the two values not equal? `['number', 'number'] => 'boolean'` `['date', 'date'] => 'boolean'` `['datetime', 'datetime'] => 'boolean'` `['boolean', 'boolean'] => 'boolean'` `['string', 'string'] => 'boolean'` |
| `lessThan` | `AgFunctionExpression<TRegistry, "lessThan">` |  | `LESSTHAN(a, b)`, or `a `['number', 'number'] => 'boolean'` |
| `greaterThan` | `AgFunctionExpression<TRegistry, "greaterThan">` |  | `GREATERTHAN(a, b)`, or `a > b`. Is the first value greater than the second? `['number', 'number'] => 'boolean'` |
| `lessThanOrEqual` | `AgFunctionExpression<TRegistry, "lessThanOrEqual">` |  | `LESSTHANOREQUAL(a, b)`, or `a `['number', 'number'] => 'boolean'` |
| `greaterThanOrEqual` | `AgFunctionExpression<TRegistry, "greaterThanOrEqual">` |  | `GREATERTHANOREQUAL(a, b)`, or `a >= b`. Is the first value greater than or equal to the second? `['number', 'number'] => 'boolean'` |
| `between` | `AgFunctionExpression<TRegistry, "between">` |  | `BETWEEN(value, low, high)`. Is the value between the two bounds? Inclusive at both ends. `['number', 'number', 'number'] => 'boolean'` `['date', 'date', 'date'] => 'boolean'` `['datetime', 'datetime', 'datetime'] => 'boolean'` Not available for text. |
| `and` | `AgFunctionExpression<TRegistry, "and">` |  | `AND(a, b)`, or `a && b`. Are both the values true? `['boolean', 'boolean'] => 'boolean'` |
| `or` | `AgFunctionExpression<TRegistry, "or">` |  | `OR(a, b)`, or `a \|\| b`. Are either of the values true? `['boolean', 'boolean'] => 'boolean'` |
| `not` | `AgFunctionExpression<TRegistry, "not">` |  | `NOT(a)`, or `NOT a`. Negates the value. `['boolean'] => 'boolean'` |
| `negate` | `AgFunctionExpression<TRegistry, "negate">` |  | `NEGATE(a)`, or `-a`. Negates the value. `['number'] => 'number'` |
| `if` | `AgFunctionExpression<TRegistry, "if">` |  | `IF(condition, whenTrue, whenFalse)`. If the first value is true then return the second value, else return the third value. `['boolean', 'string', 'string'] => 'string'` `['boolean', 'number', 'number'] => 'number'` `['boolean', 'boolean', 'boolean'] => 'boolean'` `['boolean', 'date', 'date'] => 'date'` `['boolean', 'datetime', 'datetime'] => 'datetime'` |
| `switch` | `AgFunctionExpression<TRegistry, "switch">` |  | `SWITCH(value, case1, result1, case2, result2, ..., defaultResult)`. Evaluates the first value against each case in order and returns the corresponding result for the first matching case. If no cases match, returns the default result. At least one case and its result are required. |
| `in` | `AgFunctionExpression<TRegistry, "in">` |  | `IN(value, option1, option2, ...)`. Is the first value in any of the subsequent values? `['string', ...'string'] => 'boolean'` `['number', ...'number'] => 'boolean'` `['boolean', ...'boolean'] => 'boolean'` `['date', ...'date'] => 'boolean'` `['datetime', ...'datetime'] => 'boolean'` |
| `isTrue` | `AgFunctionExpression<TRegistry, "isTrue">` |  | `ISTRUE(value)`. Is the value true? `['boolean'] => 'boolean'` |
| `isFalse` | `AgFunctionExpression<TRegistry, "isFalse">` |  | `ISFALSE(value)`. Is the value false? `['boolean'] => 'boolean'` |
| `isNull` | `AgFunctionExpression<TRegistry, "isNull">` |  | `ISNULL(value)`. Is the value null? `['string'] => 'boolean'` `['number'] => 'boolean'` `['boolean'] => 'boolean'` `['date'] => 'boolean'` `['datetime'] => 'boolean'` |
| `coalesce` | `AgFunctionExpression<TRegistry, "coalesce">` |  | `COALESCE(value, ...)`. Returns the first non-null value from the list of arguments. |
| `isNotNull` | `AgFunctionExpression<TRegistry, "isNotNull">` |  | `ISNOTNULL(value)`. Is the value not null? `['string'] => 'boolean'` `['number'] => 'boolean'` `['boolean'] => 'boolean'` `['date'] => 'boolean'` `['datetime'] => 'boolean'` |
| `datediff` | `AgFunctionExpression<TRegistry, "datediff">` |  | `DATEDIFF(unit, start, end)`. Return the number of units defined by the first value that are between the second and third values. ['string', 'date', 'date'] => number ['string', 'datetime', 'datetime'] => number Supported units: Milliseconds - `'millisecond' \| 'ms'` Seconds - `'second' \| 'ss' \| 's'` Minutes - `'minute' \| 'mi' \| 'n'` Hours - `'hour' \| 'hh'` Days - `'day' \| 'dy' \| 'y'` Weeks - `'week' \| 'ww' \| 'wk'` Weekdays - `'weekday' \| 'dw' \| 'w'` Months - `'month' \| 'mm' \| 'm'` Quarters -`'quarter' \| 'qq' \| 'q'` Years - `'year' \| 'yyyy' \| 'yy'` Days of year - `'dayofyear'` |
| `dateAdd` | `AgFunctionExpression<TRegistry, "dateAdd">` |  | `DATEADD(unit, date, amount)`. Add a signed integer number of units to a date or datetime. `['string', 'date', 'number'] => 'date'` `['string', 'datetime', 'number'] => 'datetime'` Supported units: `'year' \| 'quarter' \| 'month' \| 'week' \| 'day'` (and `'hour' \| 'minute'` for datetime only). Month-end clamping applies: adding one month to Jan 31 yields Feb 28/29. |
| `dateFromParts` | `AgFunctionExpression<TRegistry, "dateFromParts">` |  | `DATEFROMPARTS(year, month, day)`. Construct a date from integer year, 1-based month, and day components. `['number', 'number', 'number'] => 'date'` Returns null when the components do not form a real date, such as 30 February. Not accepted as a calendar `range` endpoint. |
| `dateTrunc` | `AgFunctionExpression<TRegistry, "dateTrunc">` |  | `DATETRUNC(unit, date)`. Truncate a date or datetime to the start of a given unit. `['string', 'date'] => 'date'` `['string', 'datetime'] => 'datetime'` Supported units: `'year' \| 'quarter' \| 'month' \| 'week' \| 'day'` (and `'hour'` for datetime only) |
| `dateEnd` | `AgFunctionExpression<TRegistry, "dateEnd">` |  | `DATEEND(unit, date)`. Return the end of a date or datetime period for a given unit. `['string', 'date'] => 'date'` `['string', 'datetime'] => 'datetime'` Supported units: `'year' \| 'quarter' \| 'month' \| 'week' \| 'day'` (and `'hour'` for datetime only) |
| `dateExtract` | `AgFunctionExpression<TRegistry, "dateExtract">` |  | `DATEEXTRACT(unit, date)`. Extract a single integer component from a date or datetime. `['string', 'date'] => 'number'` `['string', 'datetime'] => 'number'` Supported units: `'year' \| 'isoYear' \| 'quarter' \| 'month' \| 'week' \| 'day' \| 'hour' \| 'dayOfYear' \| 'dayOfWeek' \| 'monthOfQuarter' \| 'weekOfMonth' \| 'weekend' \| 'timeOfDay' \| 'minute' \| 'second' \| 'dayOfMonth'` |
| `percentiles` | `AgFunctionExpression<TRegistry, "percentiles">` |  | `PERCENTILES(field, p1, p2, ...)`. Compute multiple percentiles of the grouped values of the target numeric field, producing one output column per `p` value. Each is computed as for `percentile`. First input: the source numeric field Remaining inputs: percentile values (0-1), one per desired output column |
| `percentile` | `AgFunctionExpression<TRegistry, "percentile">` |  | `PERCENTILE(field, p)`. Compute the value at percentile `p` (0-1) of the grouped values of the target numeric field. Null values are ignored. Of the `n` values in ascending order, counted from 0, the result is the one at position `p * (n - 1)`, interpolated linearly between the two values either side when that position falls between them. A `p` outside 0-1 gives `null`. `['number', 'number'] => 'number'` |
| `median` | `AgFunctionExpression<TRegistry, "median">` |  | `MEDIAN(field)`. Shorthand for `percentile(field, 0.5)`, so with an even number of values the result is the mean of the two middle values. `['number'] => 'number'` |
| `currentDate` | `AgFunctionExpression<TRegistry, "currentDate">` |  | `CURRENTDATE()`. Returns the current date as a DATE value. Session-constant: all rows in a single query receive the same value. `[] => 'date'` |
| `currentTimestamp` | `AgFunctionExpression<TRegistry, "currentTimestamp">` |  | `CURRENTTIMESTAMP()`. Returns the current date and time as a TIMESTAMP value. Session-constant: all rows in a single query receive the same value. `[] => 'datetime'` |
| `abs` | `AgFunctionExpression<TRegistry, "abs">` |  | `ABS(x)`. Returns the absolute value of a number. `['number'] => 'number'` |
| `mod` | `AgFunctionExpression<TRegistry, "mod">` |  | `MOD(a, b)`. Returns the remainder when the first number is divided by the second (modulo). The sign of the result follows the sign of the dividend. `['number', 'number'] => 'number'` |
| `floor` | `AgFunctionExpression<TRegistry, "floor">` |  | `FLOOR(x)`. Returns the largest integer less than or equal to the given number. `['number'] => 'number'` |
| `ceiling` | `AgFunctionExpression<TRegistry, "ceiling">` |  | `CEILING(x)`. Returns the smallest integer greater than or equal to the given number. `['number'] => 'number'` |
| `round` | `AgFunctionExpression<TRegistry, "round">` |  | `ROUND(x)` or `ROUND(x, scale)`. Rounds a number to the nearest integer at the specified scale. Uses round-half-away-from-zero semantics. `['number', 'number'] => 'number'` `['number'] => 'number'` (scale defaults to 0) |
| `truncate` | `AgFunctionExpression<TRegistry, "truncate">` |  | `TRUNCATE(x)` or `TRUNCATE(x, scale)`. Truncates a number to the specified scale toward zero. `['number', 'number'] => 'number'` `['number'] => 'number'` (scale defaults to 0) |
| `power` | `AgFunctionExpression<TRegistry, "power">` |  | `POWER(base, exponent)`, or `base ^ exponent`. Raises the base to the power of the exponent. `['number', 'number'] => 'number'` |
| `exp` | `AgFunctionExpression<TRegistry, "exp">` |  | `EXP(x)`. Returns e raised to the power of the given number. `['number'] => 'number'` |
| `sin` | `AgFunctionExpression<TRegistry, "sin">` |  | `SIN(x)`. Returns the sine of a number in radians. `['number'] => 'number'` |
| `cos` | `AgFunctionExpression<TRegistry, "cos">` |  | `COS(x)`. Returns the cosine of a number in radians. `['number'] => 'number'` |
| `tan` | `AgFunctionExpression<TRegistry, "tan">` |  | `TAN(x)`. Returns the tangent of a number in radians. `['number'] => 'number'` |
| `asin` | `AgFunctionExpression<TRegistry, "asin">` |  | `ASIN(x)`. Returns the arcsine of a number (inverse sine) in radians. Result is in the range [-π/2, π/2]. Input must be in the range [-1, 1]. `['number'] => 'number'` |
| `acos` | `AgFunctionExpression<TRegistry, "acos">` |  | `ACOS(x)`. Returns the arccosine of a number (inverse cosine) in radians. Result is in the range [0, π]. Input must be in the range [-1, 1]. `['number'] => 'number'` |
| `atan` | `AgFunctionExpression<TRegistry, "atan">` |  | `ATAN(x)`. Returns the arctangent of a number (inverse tangent) in radians. Result is in the range [-π/2, π/2]. `['number'] => 'number'` |
| `atan2` | `AgFunctionExpression<TRegistry, "atan2">` |  | `ATAN2(y, x)`. Returns the arctangent of the quotient of two numbers (two-argument arctangent) in radians. Result is in the range [-π, π]. `['number', 'number'] => 'number'` |
| `ln` | `AgFunctionExpression<TRegistry, "ln">` |  | `LN(x)`. Returns the natural logarithm (base e) of a number. `['number'] => 'number'` |
| `log` | `AgFunctionExpression<TRegistry, "log">` |  | `LOG(base, x)`. Returns the logarithm of the second number to the base specified by the first number. `['number', 'number'] => 'number'` |
| `log10` | `AgFunctionExpression<TRegistry, "log10">` |  | `LOG10(x)`. Returns the base-10 logarithm of a number. `['number'] => 'number'` |
| `greatest` | `AgFunctionExpression<TRegistry, "greatest">` |  | `GREATEST(a, b, ...)`. Returns the maximum value of two or more numbers. Returns NULL if any argument is NULL. `['number', ...'number'] => 'number'` |
| `least` | `AgFunctionExpression<TRegistry, "least">` |  | `LEAST(a, b, ...)`. Returns the minimum value of two or more numbers. Returns NULL if any argument is NULL. `['number', ...'number'] => 'number'` |
| `upper` | `AgFunctionExpression<TRegistry, "upper">` |  | `UPPER(text)`. Converts a string to uppercase. `['string'] => 'string'` |
| `lower` | `AgFunctionExpression<TRegistry, "lower">` |  | `LOWER(text)`. Converts a string to lowercase. `['string'] => 'string'` |
| `substring` | `AgFunctionExpression<TRegistry, "substring">` |  | `SUBSTRING(text, start)` or `SUBSTRING(text, start, length)`. Extracts a substring from a string. `['string', 'number'] => 'string'` (FROM start position to end of string) `['string', 'number', 'number'] => 'string'` (FROM start position FOR length) Positions are 1-indexed. Positions before 1 still count towards the length, so a start of 0 with a length of 3 returns the first two characters. |
| `position` | `AgFunctionExpression<TRegistry, "position">` |  | `POSITION(needle, haystack)`. Returns the 1-indexed position of the first occurrence of needle in haystack. `['string', 'string'] => 'number'` Returns 0 if needle is not found, 1 if needle is empty. NULL on either argument yields NULL. |
| `ltrim` | `AgFunctionExpression<TRegistry, "ltrim">` |  | `LTRIM(text, characters)`. Removes the specified characters from the left side of a string. `['string', 'string'] => 'string'` Second argument is a set of characters to strip from the left side. |
| `rtrim` | `AgFunctionExpression<TRegistry, "rtrim">` |  | `RTRIM(text, characters)`. Removes the specified characters from the right side of a string. `['string', 'string'] => 'string'` Second argument is a set of characters to strip from the right side. |
| `btrim` | `AgFunctionExpression<TRegistry, "btrim">` |  | `BTRIM(text, characters)`. Removes the specified characters from both sides of a string. `['string', 'string'] => 'string'` Second argument is a set of characters to strip from both ends. |
| `overlay` | `AgFunctionExpression<TRegistry, "overlay">` |  | `OVERLAY(text, replacement, start)` or `OVERLAY(text, replacement, start, length)`. Replaces a substring with another string at a specified position. `['string', 'string', 'number'] => 'string'` (FROM start, replace to end of replacement) `['string', 'string', 'number', 'number'] => 'string'` (FROM start FOR length) Start position is 1-indexed. When length is omitted, defaults to the replacement length. |
| `like` | `AgFunctionExpression<TRegistry, "like">` |  | `LIKE(text, pattern)`, `LIKE(text, pattern, escape)` or `LIKE(text, pattern, escape, matchCase)`. SQL `LIKE` wildcard pattern match: `%` matches any sequence of characters, `_` matches any single character. `['string', 'string'] => 'boolean'` `['string', 'string', 'string'] => 'boolean'` (third argument is the `ESCAPE` character) `['string', 'string', 'string', 'boolean'] => 'boolean'` (fourth argument is `matchCase`) Case-sensitive unless `matchCase` is `false` or null, when the match ignores case as the `like` filter does by default. To set `matchCase` without an escape character, pass a null escape. NULL text yields NULL. Use `notLike` for the negation. |
| `notLike` | `AgFunctionExpression<TRegistry, "notLike">` |  | `NOTLIKE(text, pattern)`, `NOTLIKE(text, pattern, escape)` or `NOTLIKE(text, pattern, escape, matchCase)`. The negation of `like`: true when the text does not match the pattern. `['string', 'string'] => 'boolean'` `['string', 'string', 'string'] => 'boolean'` (third argument is the `ESCAPE` character) `['string', 'string', 'string', 'boolean'] => 'boolean'` (fourth argument is `matchCase`) Case-sensitive unless `matchCase` is `false` or null, as for `like`. NULL text yields NULL. |
| `contains` | `AgFunctionExpression<TRegistry, "contains">` |  | `CONTAINS(text, search)`. Does the text contain the search text? Exact and case-sensitive. `['string', 'string'] => 'boolean'` |
| `notContains` | `AgFunctionExpression<TRegistry, "notContains">` |  | `NOTCONTAINS(text, search)`. Does the text not contain the search text? Exact and case-sensitive. `['string', 'string'] => 'boolean'` |
| `startsWith` | `AgFunctionExpression<TRegistry, "startsWith">` |  | `STARTSWITH(text, prefix)`. Does the text start with the prefix? Exact and case-sensitive. `['string', 'string'] => 'boolean'` |
| `endsWith` | `AgFunctionExpression<TRegistry, "endsWith">` |  | `ENDSWITH(text, suffix)`. Does the text end with the suffix? Exact and case-sensitive. `['string', 'string'] => 'boolean'` |
| `sign` | `AgFunctionExpression<TRegistry, "sign">` |  | `SIGN(x)`. Returns the sign of a number (-1, 0, or 1). `['number'] => 'number'` Returns -1 for negative, 0 for zero, 1 for positive. NULL input yields NULL. |
