Report Designer - Advanced conditional formatting
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.

Cause
Resolution

Before following the steps below you must open your document in Sage Report Designer.

Set the format method to advanced
  1. In Report Designer, on the menu bar click Tools then click Options.
  2. 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.

  1. In Report Designer, click the data field or variable you want format.
  2. In the Properties pane, click Conditional Formatting then click the finder button

    .
  3. 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 then

begin
            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) then

begin
            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 changeSyntax
Text ColourTextStyle->Color := NamedColor("InsertColour");
BoldTextStyle->Bold := True;
ItalicTextStyle->Italic := True;
StrikeoutTextStyle->Strikeout := True;
UnderlineTextStyle->Underline := "Double";
OverlineTextStyle->Overline := "Double";
StyleFormatting := FormattingStyle("Small Heading");
Suppress PrintingSuppressPrinting := True;
AutogrowAutoGrow := True;
WordwrapWordWrap := False;
LockedLocked := True;
VisibleVisible := False;
FontTextStyle->FontName := "Arial";
Print On First Copy OnlyPrintOnFirstCopyOnly := True;
Horizontal AlignmentTextStyle->Alignment := "Right";
Vertical AlignmentTextStyle->VerticalAlignment := "Bottom";

Once you've added your conditional formatting you should save the changes to your document.

[BCB:19:UK - Sales message :ECB]


Steps to duplicate
Related Solutions