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 aTotal_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
- Right-click the report and choose Edit Formatting Rule Sheet.... The editor of the report rules opens.
- Add a rule and name it, such as
Negative. - Enter the condition
[Total_ic] < 0. Double-clickTotal_icin the field list of the editor to insert it. Double-clickTotal_icin the field list of the editor to insert it. - In the formatting of the rule, set Foreground Color to red. You can also set the font and background.
- Close the editor.
Apply it to a control
-
Select the cell or label that prints
Total_ic. -
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. -
Click the Preview tab, then click Save.
Highlight overdue dates
- Repeat the steps with the condition
[DueDate] < Today()and apply the rule to the control that printsDueDate.
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
| Situation | Why it happens | What 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. |
Related
This page applies to alameen ERP 10, version 10.1.79.764.