AdapTableQL is a sophisticated, custom Query Language developed by the Adaptable Tools team to evaluate and execute queries.
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
Predicates and Expressions are both intended to be fully human-readable and can, fairly easily, be written entirely by hand.
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.
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.
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:
|defaultAggregationFunctions||Aggregation Expression Functions available in AdapTableQL||null (sets all)|
|defaultBooleanFunctions||Boolean Expression Functions available in AdapTableQL||null (sets all)|
|defaultObservableFunctions||Observable Expression Functions available in AdapTableQL||null (sets all)|
|defaultScalarFunctions||Scalar Expression Functions available in AdapTableQL||null (sets all)|
|maxTimeframeSize||Maximum time (in milliseconds) to hold a Data Change event in a trailing timeframe (see observableExpressionFunctions); value is capped at 86400000 (~24 hours) for performance reasons||28800000 (~8 hours)|
|moduleExpressionFunctions||Module specific ExpressionFunctions; if not defined, it falls back to the defined default values||undefined (defaults to default values)|
|performExpressionValidation||Validate Expressions before they can be run or saved||true|
|queryableColumns||Columns that can be included in AdapTableQL Expressions; leave unset to include ALL, provide empty array to set NONE||undefined|
Query Language API
The Query Language API section of Adaptable API contains functions relating to AdapTableQL:
|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|
The following demos contain Expressions: