Skip to main content

Highlight negative or overdue values

Make a value stand out when a condition is true, such as a negative amount or a due date that has passed. A formatting rule does this without changing the data. The example uses the Invoice document type.

Before you begin​

  • Open the designer from a saved invoice, on a template you may change. See Design an advanced report.
  • Choose the control to highlight, such as the cell that prints Total_ic, and write the condition as an expression that is true or false. For example [Total_ic] < 0. Both the "Bill" table (the invoice header) and the "Bill Items" table have a Total_ic: take the one the control prints.
  • For overdue dates, the field list has the "Checks" table, with the field DueDate.

Steps​

Create the rule​

  1. Right-click the report and choose Edit Formatting Rule Sheet.... The editor of the report rules opens.
  2. Add a rule and name it, such as Negative.
  3. Enter the condition [Total_ic] < 0. Double-click Total_ic in the field list of the editor to insert it. Double-click Total_ic in the field list of the editor to insert it.
  4. In the formatting of the rule, set Foreground Color to red. You can also set the font and background.
  5. Close the editor.

Apply it to a control​

  1. Select the cell or label that prints Total_ic.

  2. In the Properties panel, open Formatting Rules and add the rule Negative. A control can have several rules. The rules that are further down the list win.

  3. Click the Preview tab, then click Save.

Highlight overdue dates​

  1. Repeat the steps with the condition [DueDate] < Today() and apply the rule to the control that prints DueDate.

Result​

A line prints in red when its total is below zero, for example -120.00 on a return invoice, and in the normal colour otherwise. The overdue rule colours a cheque whose due date is before the day of printing. The rule affects only the printed look. Nothing changes in accounts or stock.

If something goes wrong​

SituationWhy it happensWhat to do
No line is coloured.The rule is not added to the control, or the condition is never true.Check Formatting Rules of the control, and test the condition in the Expression Editor.
The editor says the condition must be true or false.The expression returns a number or text.Use a comparison, such as < 0.
The colour is wrong in some cells.Another rule on the control comes later in the list.Change the order of the rules.

This page applies to alameen ERP 10, version 10.1.79.764.