Working with the expression editor
You can enter the expression editor to add or edit an expression wherever you see the symbol
in the properties panel while editing a visualization. The symbol indicates an expression field. Click to enter the expression editor.You can add expressions in two ways. Simple expressions can be inserted directly from the Fields panel by making selections from the available fields and functions. You can add more complex expressions by typing directly into the expression field.
Inserting an expression by selecting from the Fields panel
You can insert an expression by making selections from the Fields panel at the right-hand side of the expression editor dialog.
Do the following:
- Select a field from the Field drop-down list.
- If you want to limit the available fields to those from a particular table in your data model, select a table from the drop-down list marked Show fields from table.
- Select the aggregation function you want to use. The functions available are from the group of basic aggregation functions.
-
Click Insert to insert the field and the function into the expression editor.
Tip noteIf you do not select an aggregation function, only the field will be inserted into the expression. -
Click Apply to close the Add expression dialog.
For a dimension or measure, you continue by adding descriptive data for the dimension or measure.
Adding or editing an expression by typing
Do the following:
-
Type the expression directly in the expression editor.
The field names you use in the expression are checked, and the syntax of the expression is validated.
Tip noteAs you type in the expression editor, the expression is validated. If there is an error, you see a hint about what is incorrect. Additional error information may be available by clicking the icon next to the hint.When you type the name of a function in the expression, a tooltip appears that provides information to help you enter the function correctly, including argument names and qualifiers.
Information noteThe tooltip for some chart functions shows the ALL qualifier. It is recommended that you do not use the ALL qualifier. Instead, use the set expression {1}.Each line in the expression editor is numbered and syntax highlighting is used.
-
Click Apply to close the Add expression dialog.
For a dimension or measure, you continue by adding descriptive data for the dimension or measure.
Rules for expressions
The following rules apply for chart expressions:
-
All expressions return a number and/or a string, whichever is appropriate.
-
Logical functions and operators return 0 for False, -1 for True. Number-to-string conversions and string-to-number conversions are implicit.
-
Logical operators and functions interpret 0 as False and all else as True.
-
Expressions that cannot be correctly evaluated, for example as a result of incorrect parameters or functions, return NULL.
Detailed syntax help
You can open the online help with the full description of how to use the current function by double-clicking the function name in the expression editor and pressing Ctrl+H on the keyboard. This feature becomes available after having entered the first parenthesis of the expression after the function name.