Many retailers do not want to show a total discount to a consumer if its value is 0. This document describes how this can be achieved in the Report Designer. Report 105, Extended Sales Order, is used as an example.
If the calculated field “TotalDiscount” does not yet exist, it must first be created.

This can be done by right-clicking in the field list and selecting “Add calculated field”.

After adding a new field, it will initially appear in the field list as “calculatedField1”.

Now right-click on this field and choose “Edit Calculated Fields”.

In the screen shown, enter a recognisable name in the “Name” field, as this is how the field will appear in the Fields list. In this example, the name “TotalDiscount” is used.

Next, locate the field again in the field list under the name “TotalDiscount” and choose “Edit Expression”.

The contents of the calculated field must be entered as shown below. A calculation is made of the total amount of discount applied to the sales order by subtracting the net total order value from the weighted total amount. It is possible to select the two fields from the red-outlined area, but they may also be entered manually. The text must match exactly, although upper- and lower-case letters do not matter.

The TotalDiscount field used in this example should not be confused with the total discount amount at the line level. It is certainly possible to create a field for that as well, but this documentation focuses on the total discount applied to the overal order total.
Now go to the layout and select the cell “Total net”. If you look closely at the image below, you can see that this field is highlighted with a blue outline.

By pressing “Escape” once, the parent control of which the discount cell is part will be selected. This is the row that contains both the label and the total discount amount.

Now right-click on this row and choose “Properties” to display the properties of the row.

In the “Properties” window, the name of the row should be visible (in this example “rowDiscount”) and, more importantly, the type of the row, which should be “Table Row”. This confirms that the correct row has been selected.

Go to the second tab (with the two blue cogwheels) and click on the empty square next to “Visible”. From the menu that appears, choose “Visible Expression”. This indicates that the visibility of this row depends on the value of an expression (field).

In the “Expression Editor” screen, select the expression shown below. This specifies that the previously created field “TotalDiscount” must not be equal to 0 in order for the row “rowDiscount” to be visible.

After saving the expression, an “F” icon (for “Function”) will appear, indicating that visibility is controlled by a function, in this case the expression you just defined.

From this point on, the row containing “TotalDiscount” will no longer be shown if no total discount has been applied.