User Query Functions Demo

AdapTableQL (AdapTable Query Language) ships with a very large number of Expression Functions that can be used in a query.

Users can add to this at run-time by providing custom expresion functions which AdapTable will invoke the query is being evaluated.

The main element to be provided is a handler property that wraps the actual JavaScript function.

Additionally description, signature and examples properties can be provided which are displayed in the Expression Editor to help the run-time user.

Note the important isPredicate property; if set to true, the Expression Function can be used as the main part of a Query (which can only return booleans).

In this Demo we provide 2 custom Expression Functions:

  • IN_BUSINESS_YEAR - a Predicate user function which checks whether or not a given date is in the Current Business Year.

    Here we use it inside the Query we are running: ('IN_BUSINESS_YEAR([OrderDate]) AND IN_BUSINESS_YEAR([ShippedDate])').

    The query returns only rows where both the Order and Shipped Dates are in the current business year.

  • GBP_PRICE - a Non Predicate user function which returns the GBP conversion for a USD currency value.

    (The function uses a mock service and also passes in the Shipping Details (which we get from the Context in the handler) in order to arrive at the fictitious price.)

    The user function is used to create 2 Calculated Columns :OrderCostGBP, PackageCostGBP.

    Each Calculated Column contains an Expression which is passed the equivalent USD column as the sole input.

    Note also that we create a Format Column with the Scope of the 2 columns that adds a '£' and formats the digits.

AdapTable Help Resources:

Generating dummy data, please wait ...