AdapTable Query Language

AdapTableQL is a sophisticated, custom Query Language developed by the Adaptable Tools team to evaluate and execute queries.

note

AdapTableQL is designed to be fast, efficient and highly performant using caching and other techniques

AdapTableQL is used at run-time to evaluate 2 important constructs - both widely used in AdapTable:

  • Predicate - a type used primarily for Filters that always returns a boolean value (e.g. 'Positive', 'Today') and sometimes receives an input argument (e.g. 'Contains', 'GreaterThan')
  • Expression - a more powerful type that can contain numerous conditions and arguments, and supports multiple return types

Using AdapTableQL

Predicates and Expressions are both intended to be fully human-readable and can, fairly easily, be written entirely by hand.

note

Those provided in Predefined Config will most likely be hand written

However at run-time AdapTable provides a very helpful Expression Editor with many useful features designed to help users write Expressions and ensure valid output.

AST

Generally there is no need for developers to understand how AdapTableQL works; merely to ensure that it is provided with valid input.

One exception to this rule is if Server Searching is being used; in that scenario, the expressions and predicates will need to be evaluated remotely.

tip

To help you evaluate Expressions remotely, AdapTable makes available the AST which AdapTableQL uses for the Expression via Query API.

Query Language Options

The Query Language Options section of Adaptable Options contains some important AdapTableQL-related properties.

The full property list is as follows:

PropertyDescriptionDefault
defaultAggregationFunctionsAggregation Expression Functions available in AdapTableQLnull (sets all)
defaultBooleanFunctionsBoolean Expression Functions available in AdapTableQLnull (sets all)
defaultObservableFunctionsObservable Expression Functions available in AdapTableQLnull (sets all)
defaultScalarFunctionsScalar Expression Functions available in AdapTableQLnull (sets all)
maxTimeframeSizeMaximum time (in milliseconds) to hold a Data Change event in a trailing timeframe (see observableExpressionFunctions); value is capped at 86400000 (~24 hours) for performance reasons28800000 (~8 hours)
moduleExpressionFunctionsModule specific ExpressionFunctions; if not defined, it falls back to the defined default valuesundefined (defaults to default values)
performExpressionValidationValidate Expressions before they can be run or savedtrue
queryableColumnsColumns that can be included in AdapTableQL Expressions; leave unset to include ALL, provide empty array to set NONEundefined

Query Language API

The Query Language API section of Adaptable API contains functions relating to AdapTableQL:

MethodDescription
getASTForExpression(expression)Runs the AST that AdapTableQL creates for a expression - useful when evaluating remotely
getColumnsFromExpression(expression)Returns all Columns referenced in a Query
getModuleExpressionFunctionMap()Returns the current Module Expression Map
getQueryableColumnIds()Returns all columns that can be used in an Expression
isValidAggregationExpression(expression, module, validationErrorMessage)Whether the given AggregationExpression is valid
isValidBooleanExpression(query, module, validationErrorMessage)Whether the given BooleanExpression is valid
isValidObservableExpression(expression, module, validationErrorMessage)Whether the given ObservableExpression is valid

More Information

The following demos contain Expressions: