Summary
Description
With basic conditional formatting, you can create a filter and set a format that applies when that filter is met. However, if you want to apply conditions that are more complex or multiple conditions, you can use the advanced conditional formatting option instead.
As an alternative to conditional formatting, you can also use If statement expressions.
Resolution
Before following the steps below you must open your document in Sage Report Designer.
Set the format method to advanced
- In Report Designer, on the menu bar click Tools then click Options.
- Ensure the Use Advanced Conditional Formatting check box is clear, then click OK.
Apply advanced formatting
If you can't see the Properties pane mentioned below, on the menu bar click View then click Properties pane. If the pane doesn't appear, you can reset the Report Designer view to its default.
- In Report Designer, click the data field or variable you want format.
- In the Properties pane, click Conditional Formatting then click the finder button
.
- In Expression Editor, enter your conditional formatting expression, then click OK.
For information about the syntax used in advanced conditional formatting, please refer to the following section.
Advanced formatting syntax guide
When the Use Advanced Conditional Formatting option is selected, the Conditional Formatting window is replaced by the Expression Editor window. This requires the condition to be entered as an expression in the following format:
if condition to be met, for example, SALES_LEDGER.BALANCE > SALES_LEDGER.CREDIT_LIMIT thenbegin
the formatting to apply, for example, TextStyle->Color := NamedColor("Red");
end
You can create multiple conditions by using an else statement to separate each individual condition, for example:
if (SALES_LEDGER.BALANCE > 1000 and SALES_LEDGER.BALANCE <= 5000) thenbegin
TextStyle->Color := NamedColor("DarkOrange");
end
else
if SALES_LEDGER.BALANCE > 5000 then
begin
TextStyle->Color := NamedColor("Red");
end
The table below shows some common formatting code examples.
| To change | Syntax |
|---|---|
| Text Colour | TextStyle->Color := NamedColor("InsertColour"); |
| Bold | TextStyle->Bold := True; |
| Italic | TextStyle->Italic := True; |
| Strikeout | TextStyle->Strikeout := True; |
| Underline | TextStyle->Underline := "Double"; |
| Overline | TextStyle->Overline := "Double"; |
| Style | Formatting := FormattingStyle("Small Heading"); |
| Suppress Printing | SuppressPrinting := True; |
| Autogrow | AutoGrow := True; |
| Wordwrap | WordWrap := False; |
| Locked | Locked := True; |
| Visible | Visible := False; |
| Font | TextStyle->FontName := "Arial"; |
| Print On First Copy Only | PrintOnFirstCopyOnly := True; |
| Horizontal Alignment | TextStyle->Alignment := "Right"; |
| Vertical Alignment | TextStyle->VerticalAlignment := "Bottom"; |
Once you've added your conditional formatting you should save the changes to your document.
Upgrade your licence
Growing business? Add more companies, users, or employees to your licence with ease. Leave your details and we’ll be in touch.
