# Evaluating Expressions Externally

Canonical page: https://www.adaptabletools.com/docs/adaptable-ql-expression-evaluating

- Most Expressions are evaluated automatically by AdapTableQL when a Module uses them
- Developers can also use Expressions **outside the UI** — without using a Grid Filter, Alert or Calculated Column etc.
- There are 2 use cases in which this can happen:
  - [Evaluating via the API](https://www.adaptabletools.com/docs/adaptable-ql-expression-evaluation/index.md) — AdapTableQL still runs the Expression, as an explicit call
  - [Server Evaluation](https://www.adaptabletools.com/docs/adaptable-server-evaluation/index.md) — AdapTableQL skips the Expression; you evaluate (or translate the AST) yourself

The usual workflow when evaluating an AdapTableQL Expression is as follows;

1. Something happens in the UI (a cell is rendered, a filter is applied) etc
2. The Module that owns that string, e.g. [Grid Filter](https://www.adaptabletools.com/docs/handbook-grid-filter/index.md), [Alert](https://www.adaptabletools.com/docs/handbook-alerting/index.md), [Calculated Column](https://www.adaptabletools.com/docs/handbook-calculated-column/index.md) etc. invoke AdapTableQL
3. AdapTableQL evaluates the expression, returns the result, and the grid updates as needed

However there are 2 scenarios where this full workflow is not required:

| Path                                                                                         | UI <br/>Triggered | AdapTableQL <br/> Evaluation | How it Works                                                                                                                     |
| -------------------------------------------------------------------------------------------- | :---------------: | :--------------------------: | -------------------------------------------------------------------------------------------------------------------------------- |
| [API Evaluation](https://www.adaptabletools.com/docs/adaptable-ql-expression-evaluation/index.md)              |        ❌         |              ✅              | Call `evaluateStandardExpression` / `evaluateAggregatedExpression` / `filter*` in ExpressionAPI |
| [Server Evaluation](https://www.adaptabletools.com/docs/adaptable-server-evaluation/index.md) |        ✅         |              ❌              | Implement `evaluateAdaptableQLExternally` and listen to events and use Expression AST so you can evaluate it yourself            |

## Evaluating via the API

Developers can request that [AdapTable evaluate an Expression on demand](https://www.adaptabletools.com/docs/adaptable-ql-expression-evaluation/index.md) without going through a Module or requiring an action in the UI.

Essentially you can invoke AdapTableQL yourself from your application code.

Use this when you want the **same evaluation engine** that Modules use, but as an explicit request: “run this Expression now, against this row (or this data set), and give me the result”.

- Typical uses include what-if checks or validating a user-entered Expression
- Another common use case is driving your own UI from an Expression that is not stored in a Module

## Server Evaluation

Sometimes you might want AdapTable to invoke an expression evaluation but [you wish to perform the evaluation yourself on your server](https://www.adaptabletools.com/docs/adaptable-server-evaluation/index.md), and not for AdapTableQL to evaluate for you.

An AdapTableQL Expression is a human-readable string so relatively easy to parse

- Server Evaluation here is for AG Grid's **Client-Side Row Model**, when you choose to evaluate on your server
- [Server-Side Row Model](https://www.adaptabletools.com/docs/dev-guide-row-models-server-overview/index.md) is a different path: it already forces filtering (and sorting) onto the server
