AdapTableQL (AQL)
AQL (or AdapTable Query Language) is an advanced, custom built Query Langugage.
It evaluates and executes complex queries (called expressions) defined at design or run time.
Note
- AQL is designed and implemented to be fast, efficient and highly performant, and to be able to operate on very large data sets
- It is widely used in AdapTable whenever data needs to be searched, filtered or derived
AQL is incredibly powerful, but also human readable, and can be used for:
- configuring Calculated Columns
- defining Column Filters and the Grid Filter
- applying Conditional Styles
Important
- The current AQL implemenation is a port of the library used in AdapTable for AG Grid
- However, we are in the process of moving AdapTableQL into a standalone library (with its own documentation)
- Both AdapTable extensions (for AG Grid and for Infinite Table) will access this common library (with separate UI implementations)
Expressions
At present AdapTable QL supports only standard (i.e. per-row) Expressions.
These are by far the most common type of Expression and incldes Logical Operators (AND / OR).
Hint
Future releases will include full support for all Expression types including Aggregated and Observable.
There are a huge range of Standard Expression Functions available in AQL.
These are documented fully in Adaptable For AG Grid Standard Expression Functions Guide.
Custom Expressions
AQL does not currently support Custom Expressions, i.e. bespoke Expressions provided by developers.
However this features very prominently on the roadmap and will be released very soon.
AdapTableQL in Calculated Columns
A very common use-case for AQL is Calculated Columns - the provided Expression defines the value of the column cells.
- In this example, the
Popularity
column has the following expression:[stars] > 30000 ? "HIGH": [stars] > 20000? "MEDIUM" : "LOW"
- The expression calculates the popularity of the JS framework based on the number of stars in GitHub.
AdapTableQL in Filters
AdapTableQL is also used when evaluating Filters.
Expressions are used to define Column Filters...
In this example, we use an Expression to define Column Filters for the stars
and license
columns.
filters: {
columns: [`[stars] > 40000`, `[license] CONTAINS "MIT"`],
},
...and also when providing the Grid Filter.
In this demo, we use an Expression to define the Grid Filter - which evalutes the stars
and license
columns.
filters: {
grid: `[github_stars] > 40000 AND [license] CONTAINS "MIT"`,
},
AdapTableQL in Conditional Styles
AdapTableQL is also used when applying Conditional Styles.
In this example, we use an Expression to define a Conditional Style on the Github Watchers column.
condition: {
type: 'booleanExpression',
expression: '[github_watchers] > 100 AND [github_watchers] < 500 AND [license] CONTAINS "MIT"',
},
Using Columns in AQL
Most AQL Expressions include at least one Column which is written in square brackets, e.g. [stars]
In AQL expressions, make sure you reference column ids, not the name of the data fields.
For example, if the following column is defined:
availableColumns: {
stars: { field: 'github_stars', editable: true, dataType: 'number' },
},
Expressions should reference the column as [stars]
rather than [github_stars]
.