Building expressions - Adding an operator
In Expression Builder, you can include a calculation between (the values of) two numeric fields in an additional column.
When you include string field (alphanumeric) values in your expression, enclose them with double quotes to make your expression valid. See the
AND operator for an example.
Numeric values do not require double quotes, see the
OR operator for an example. For a description of these fields, refer to
Operator fields.
After completing building an expression, click
Check to validate it.
You can combine multiple operators to build complex expressions.
The ‘if() then else’ operator uses the ‘if, then’ part to determine what the numeric output of the expression will be.
Example 1
If you use the following expression:
(If (Orders.'Actual costs incl. VAT' - Orders.'Cum. estimated amount incl. VAT' < 0) then 0 else (Orders.'Actual costs incl. VAT' - Orders.'Cum. estimated amount incl. VAT')).
The output will be rounded to whole numbers, because “0” is treated as an integer output. This is true even when the mask is applied to the field. For example, if the output of the calculation is 14223.75, the expression result will be rounded to 14223.00
Example 2
If you use the following expression:
(If (Orders.'Actual costs incl. VAT' - Orders.'Cum. estimated amount incl. VAT' < 0) then 0.00 else (Orders.'Actual costs incl. VAT' - Orders.'Cum. estimated amount incl. VAT')).
The output will be rounded to two decimals, because "0.00" is treated as a decimal output. So, the expression result for the value 14223.75 will be shown as 14223.75.
In the following example, an expression is built showing you how to calculate the difference between the purchase amount and the sales revenue of a property.
Procedure
1. Add a report for the properties business object.
2. Click the Add expression button to open the Expression builder window.
3. In the Available fields section, select the Sales revenue field and click the Add button in that section.
Or
In the Available fields section, double-click the Sales revenue field.
4. In the Operators section, click the [-] function and click the Add button in that section.
Or
In the Operators section, double-click the [-] function.
5. In the Available fields section, double-click the Acquisition amount field.
The expression has now been completed.
6. In the Expression section, click the Check button.
Planon will now check whether the expression you have built is correct.
7. Click OK to save the expression and to close the Expression builder window.
You will now return to the Report definitions and settings window. Your expression has been added to the Selected fields section.
8. In the Selected fields section, select the expression you have just created.
9. In the Settings section, specify the required field settings. For more information on field settings, refer to Making field settings. 10. View the result in the print preview of the report.