Using the expression editor
TRUECHART offers in many places the possibility to dynamically design content and interaction behavior. For this purpose, expressions can be used in different places.
Depending on the platform used, different expression types can be used in TRUECHART. In general, a distinction can be made between platform-independent TRUECHART expressions and platform-specific expressions (currently only Qlik Sense). In a particular platform does not support expressions (like Microsoft PowerBI) TRUECHART only provides TRUECHART expressions.
Thus in Qlik Sense within the button type or with alternative cell contents the powerful Sense Expressions or the TRUECHART expression logic can be used directly.
In the following, you will find an overview of the dynamic settings and an overview of the functionality of the TRUECHART Expression Editor.
Dynamic setting options
TRUECHART offers expression support in the following application areas
Cell types
Type | Field | Expression type |
---|---|---|
URL | TRUECHART (dimensions & measures) | |
All dynamic fields (like title, tooltip, icon, layout, style, color, action parameters, …) | platform specific* |
Cell settings
Area | Section | Group | Field | Expression type |
---|---|---|---|---|
Contents | Condition | platform specific* | ||
Dimensions | Filter | Applies to | TRUECHART (dimensions) | |
Condition | TRUECHART (dimensions & measures) | |||
Gap | Condition | TRUECHART (dimensions) | ||
Measures | Values Show | Applies to [List] | TRUECHART (dimensions) | |
Condition [List] | TRUECHART (dimensions & measures) | |||
General | Name | TRUECHART (variables) | ||
Display condition | platform specific* | |||
First value | Label | TRUECHART (variables) | ||
Rest value | Label | TRUECHART (variables) | ||
Total value | Label | TRUECHART (variables) | ||
General | Name | TRUECHART (variables) | ||
Display condition | platform specific* | |||
Expression | Applies to | TRUECHART (dimensions) | ||
Formula | TRUECHART (dimensions & measures) | |||
Applies to | TRUECHART (dimensions) | |||
Condition | TRUECHART (dimensions & measures) | |||
Scaling | TRUECHART (variables) | |||
Unit | TRUECHART (variables) | |||
Decimals | TRUECHART (variables) |
platform specific: Qlik Sense or TRUECHART expressions as fallback
TRUECHART Expression Editor
General
Change expression type
If there is the possibility to change the type within the expressions (platform-specific or TRUECHART internal), this can be done by using the drop-down menu in the lower left corner of the editor.
Result preview
If available, the result of the expression is displayed below the expression input field. In case expressions are executed on a list of values (such as dimension values), the first positive result is output as the result.
Execution duration
The execution time of the expression is displayed to the right of the result preview. This information can be used to analyze and optimize expressions.
Insert Operators
In general, TRUECHART offers the possibility to use a number of mathematical, comparative and logical expressions. By selecting an appropriate entry in the respective drop-down list in the "Operators" area, an operator can be inserted at the current position of the cursor.
The following operators are supported:
Mathematical
Operator | Description | Example |
---|---|---|
+ | Addition | x + y |
Subtraction | x - y | |
Multiplication | x * y | |
/ | Division | x / y |
Power of | x ** y | |
( | Left parenthesis | |
) | Right parenthesis | |
% | ROI in percent | (x + y) / y * 100 |
%O | Percent | x / y * 100 |
Comparison
Operator | Description | Example |
---|---|---|
< | Less | x < y |
<= | Less or equal | x <= y |
== | Equal | x == y |
<> | Unequal | x <> y |
>= | Bigger or equal | x >= y |
> | Bigger | x > y |
Logical
Operator | Description | Example |
---|---|---|
AND | Logical conjunction AND | (Expression A) AND (Expression B) |
OR | Logical conjunction OR | (Expression A) OR (Expression B) |
$(AND:) | Logical conjunction AND as list | $(AND:2,2,1) == 2 → false |
$(OR:) | Logical conjunction OR as list | $(OR:1,2,3) == 4 → false |
TRUECHART (variables) expressions
You can insert a variable by making selections from the General section at the right-hand side of the expression editor dialog.
Select a variable from the Variable drop-down list to insert it.
TRUECHART (dimensions) expressions
This expression type has all functions of the variables expression type described above.
The following functions are also available for this type:
You can insert a dimension based expression by making selections from the General section at the right-hand side of the expression editor dialog.
Do the following:
Optional: If you want to specify an access type due to the dimensional values select the type from the Type drop-down list. The selected value is only applied in connection with the selection of a dimension in the following drop-down and inserted together with the dimension then. Available types are:
No restriction: No impact
$(DIMENSION) OR $(D0100,POSITION; [dimension name]) // just the dimension
Position: Use of a dimension value from a specific position depending on the order of the values within the dimension.
$(DIMENSION,POSITION) > 4 OR $(D0100,POSITION; [dimension name]) == 2
First: Use the first dimension value
$(DIMENSION,FST) OR $(D0100,FST; [dimension name])
Rest: Use the dimension value, marked as rest. This value depends on the respective dimension definition in the data source (BI platform) or in the TRUECHART data context and can therefore not be present. In this case, this expression does not return anything.
$(DIMENSION,RST) OR $(D0100,RST; [dimension name])
Total: Use the dimension value, marked as a total. This value depends on the respective dimension definition in the data source (BI platform) or in the TRUECHART data context and can therefore not be present. In this case, this expression does not return anything.
$(DIMENSION,TTL) OR $(D0100,TTL; [dimension name])
Select a dimension from the Dimension drop-down list. The value 'Dimension' represents the default/first dimension in the current data context.
After selection, the dimension and the previous optional selected type will be inserted in the expression input field.
TRUECHART (dimensions & measures) expressions
This expression type contains all function has all functions of the expression types described above.
The following functions are also available for this type:
You can insert a measure based expression by making selections from the General section at the right-hand side of the expression editor dialog.
Do the following:
Optional: If you want to specify an aggregation type due to the measure values selects the type from the Aggregation drop-down list. The selected value is only applied in connection with the selection of a measure in the following drop-down and inserted together with the measure then. Available types are:
No aggregation: No impact
$(K01; [measure name]) // just the first measure
Sum: Calculates the sum of corresponding measure.
$(K01,SUM; [measure name]) //sum of the first measure in current data context
Average: Calculates the average of corresponding measure.
$(K03,AVG; [measure name]) //Average of the third measure in current data context
Minimum: Calculates the minimum of corresponding measure.
$(K05,MIN; [measure name]) //Minimum of the fifth in current data context
Maximum: Calculates the maximum of corresponding measure.
$(K035,MAX; [measure name]) //Maximum of the third measure in current data context
Select a measure from the Measure drop-down list.
After selection, the measure and the previous optional selected aggregation will be inserted in the expression input field.
platform specific: Qlik Sense expressions
TRUECHART provides an easy to use expression editor for creation of sense expressions. Basic and advanced information about writing Qlik Sense expressions can be found in the Qlik Sense expression documentation.
Inserting an expression using Fields
You can insert an expression by making selections from the Fields section at the right-hand side of the expression editor dialog.
Do the following:
If you want to limit the available fields to those from a particular table in your data model, select a table from the Filter by table drop-down list.
Select a field from the Field drop-down list.
Select the aggregation function you want to use from the following drop-down list.
Click Insert to insert the field and the function into the expression field.
If you do not select an aggregation function, only the field will be inserted into the expression. Clauses can only be added if you select an aggregation function.
Inserting a variable using Variables
You can insert a variable by making selections from the General section at the right-hand side of the expression editor dialog.
Select a variable from the Variable drop-down list to insert it.
For variables, only the name is inserted. For sense expression logic it may be necessary to surround the variable name with '$([your variable])'.