Expression Editor
Summary
- The Expression Editor is a very useful UI tool for writing and validating Expressions
- Contains all the Expression Functions, operators and Columns in an intuitive drag-n-drop format
- Also displays full and comprehensive context sensitive help
Run-time Expressions are created using AdapTable's Expression Editor.
Hint
AdapTable also provides a Query Builder for creating Boolean Expressions
Editor Features
This screen has a number of useful features including:
-
Ability to Drag & Drop Columns, Functions and Operators into the Editor
-
Displays commonly-used operators as buttons above the Editor
-
Ensures that the functions and operators displayed are suitable for the type of Expression being created (e.g. Observable, Scalar etc)
-
Shows existing Named Queries in a list so they can be dragged into the Editor when using the QUERY Function
-
Lists all the Columns in the Grid - using the more recognisable Column Header (a.k.a. FriendlyName)
-
Displays the first row of data in the Grid for scenario analysis
Note
Data is taken from the first row of the Grid - but it can be edited by the user in order to try out different scenarios
-
Provides a search box above the Column List to make it easy to find a particular column
-
Highlights the return value of the Expression
-
Context-sensitive Support and Help for each available function - the Editor explains what the function does, shows its definition and provides relevant examples
-
Links to these Help Pages for detailed information on writing Expressions and the available options
Hint
Set
showDocumentationLinksto false in User Interface Options to hide links to this Documentation -
Displays a warning - and prevents the user from continuing - if the Expression is not valid
-
Provides a 2nd text area if the
WHEREclause is selected (in Observable and Aggregation Expressions)
Functions Dropdown
There are many Expression Functions that can be provided in an Expression.
These are available in the Functions dropdowns on the left of the toolbar above the Editor.
Note
This list includes any Custom Expression Functions provided by developers at design-time
The functions have been divided into these groups for ease of use:
- Special
- Logical
- Comparison
- Strings
- Maths
- Dates
Hovering over a function provides extensive help including:
- details about what the function does
- the arguments it expects
- its return value
- examples of the function
Hint
Clicking on one of the Functions listed in the Dropdown will immediately render it in the Editor
- This demo showcases the AdapTableQL Expression Editor
- When it opens, it displays the Current Grid Filter in the Editor
Column Ids & Headers
Many Columns often contain a separate Id and Header.
The Id is typically the field in the data source it connects to, or a unique identifier.
By contrast, the Header is what appears in the Grid and how the Column is referred to in the UI.
The Expression Editor uses both of these properties.
By default Columns are listed on the right hand side using the Header (also known as the Friendly Name).
Hint
There is a checkbox to allow you to see the Column's Id instead
However in the Editor itself the Column Id is used when referencing the Column (using the square brackets).
The reason for this is that a Column Id is guaranteed to be unique, while its quite common to have multiple columns in the Grid which share the same Header.
Note
This typically happens when using Column Groups - e.g. multiple groups might each have 'Buy' and 'Sell' Columns
Wherever an Expression in AdapTable is referenced but is not being directly edited - e.g. when displayed in the Settings Panel, the Column's Header is used.
Hint
Set displayColumnFriendlyNamesForExpressions to true in expressionOptions section of Expression Options if you wish to use the Column Id whenever Expressions are displayed in AdapTable