Evaluating Expressions Externally

View as Markdown

Summary

  • 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:

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, Alert, Calculated Column 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:

PathUI
Triggered
AdapTableQL
Evaluation
How it Works
API Evaluation❌✅Call evaluateStandardExpression / evaluateAggregatedExpression / filter* in ExpressionAPI
Server Evaluation✅❌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 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”.

Hint

  • 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, and not for AdapTableQL to evaluate for you.

Note

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

Caution

  • Server Evaluation here is for AG Grid's Client-Side Row Model, when you choose to evaluate on your server
  • Server-Side Row Model is a different path: it already forces filtering (and sorting) onto the server