Using the expression editor
The expression editor in IBM® Cognos® Analytics is part of the product user interface where you can create and edit calculations, filters, and SQL expressions.
You access the expression editor when performing the following tasks:
- Creating or editing calculations
- Creating or editing filters
- Creating or editing SQL-based tables
- Viewing the Expression property on columns
The following screen capture shows the expression editor user interface:
The Components pane includes the data tab , and the functions tab
.
The data tab
contains the data module tree. You can drag tables and columns from the tree into the
Expression box to create expressions.
The functions tab shows the list of supported functions and operators that you can use in the
expressions. You can drag the functions into the Expression box to create
expressions. For more information, see Creating expressions. The functions tab
is not available in all contexts, for example, when creating SQL tables.
The Expression area is the primary work area to create, edit, or view expressions. Here you can type or paste the expression or SQL code. Then, you can validate the code, and preview the projected columns or table.
The expression editor provides the following syntax validation and editing options:
- Validate the syntax. You can validate the whole statement, or only selected segments of code.
- Preview columns and rows in your projected calculation, filter, or table. If the syntax is not correct, the columns are not displayed.
- View descriptions of functions, and examples of their usage.
- Insert the cursor anywhere in a line of code and select this button to comment out the entire line. To comment out multiple lines of code, select the lines and select this button. The comment string
//
is added at the beginning of each selected line.Tip: To comment out sections of code, manually enclose the text between the following strings:/*
and*/
- Apply formatting to the code.
- Use high-contrast mode.
- Change the font size.
For more information about working in the expression editor, including examples, see this article in the IBM Cognos Analytics community.