Sage 200 Report Designer - How to apply conditional formatting to a variable
Description

One of the features of Sage Report Designer is the ability to format objects in a certain way, depending on specific conditions. For example, you can choose to display all customer balances over £1000 in red. 

NOTE: This article has been prepared and issued to you as a goodwill gesture only and Sage accepts no liability or responsibility for its use. For further support please refer to your Business Partner.

Cause
Resolution

These are the basic steps that explain how to apply conditional formatting to objects on your report. They include:

NOTE: Quick steps provide the minimum amount of information you need. For further information, please refer to the Detailed steps tab.

This article assumes that you have located the report or layout that you want to amend and opened it in Sage Report Designer. If you need further help with this, please refer to the following article.

Basic and advanced conditional formatting

There are two methods of conditional formatting that you can use.

  • Basic conditional formatting - Using this option you can set a filter, then from a list of format settings you can choose the format to apply when the filter is met.

  • Advanced conditional formatting - Using this option you can enter an expression to determine what format applies when certain conditions are met. With this method you can apply more than one set of formatting to the object. For example, if you want an object to appear in red if one condition is met and to appear in blue if a different condition is met.

To select the type of conditional formatting to use:

  1. Tools > Options > amend the Use Advanced Conditional Formatting option as follows:

    • To use the basic method - Clear the Use Advanced Conditional Formatting check box.
    • To use the advanced method - Select the Use Advanced Conditional Formatting check box.
  2. Click OK.

To apply basic conditional formatting to a variable

NOTE: Before following the steps in this section you should check that Report Designer is set to use basic conditional formatting. For further information, please refer to the previous section Basic and advanced conditional formatting.

  1. Select the required variable > Properties pane > Conditional Formatting > click the finder button .
  2. Filter tab > Edit > create the required filter > OK.

    TIP: If you are using Report Designer v1.3 or above and your filter is too complex for the Modify Filter window, click Use Advanced Filter, enter the filter in the Expression Editor window then click OK. You can check your Report Designer version in Help > About > Application > File Version.

  3. Properties tab > set the properties to apply when the condition is met > OK.

To apply advanced conditional formatting to a variable

NOTE: Before following the steps in this section you should check that Report Designer is set to use basic conditional formatting. For further information, please refer to the section Basic and advanced conditional formatting earlier in this article.

  1. Select the required variable > Properties pane > Conditional Formatting > click the finder button .
  2. Expression Editor window > enter the required expression > OK.

    For information about the syntax used in advanced conditional formatting, please refer to the Detailed steps tab.

To save the changes to your document
  1. Report menu > Report Properties > enter a new name and description for the document > OK.

    Report Designer v1.3 and below - Report Explorer pane > select the document name > Properties pane > Name > enter a new name for the document > Enter.

    TIP: You can check your Report Designer version in Help > About > Application > File Version.

  2. File > Save As > File name > enter a new file name > browse to the required location for your document > Save.
  3. File > Exit.

The following detailed steps contain everything you need to help you to apply conditional formatting to objects on your report.

This article assumes that you have located the report or layout that you want to amend and opened it in Sage Report Designer. If you need further help with this, please refer to the following article.

NOTE: If any of the panes mentioned in this section are not visible, open the View menu and select the required pane. If the pane doesn't appear, you can reset the Report Designer view to its default. For further information about this, please refer to the following article.

Basic and advanced conditional formatting

There are two methods of conditional formatting that you can use.

  • Basic conditional formatting - Using this option you can set a filter, then from a list of format settings you can choose the format to apply when the filter is met.

  • Advanced conditional formatting - Using this option you can enter an expression to determine what format applies when certain conditions are met. With this method you can apply more than one set of formatting to the object. For example, if you want an object to appear in red if one condition is met and to appear in blue if a different condition is met.

To select the type of conditional formatting to use:

  1. From the Sage Report Designer menu bar, open the Tools menu and choose Options.

  2. In the Options tab, amend the Use Advanced Conditional Formatting option as follows:

    • To use the basic method - Clear the Use Advanced Conditional Formatting check box.
    • To use the advanced method - Select the Use Advanced Conditional Formatting check box.
  3. To confirm the changes click OK.
To apply basic conditional formatting to a variable

NOTE: Before following the steps in this section you should check that Report Designer is set to use basic conditional formatting. For further information, please refer to the previous section Basic and advanced conditional formatting.

  1. Locate and select the variable to which you want to apply the conditional formatting, for example, SLCustomerAccounts.AccountBalance.

  2. From the Properties pane, select Conditional Formatting then click the finder button .

    NOTE: Using the Filter tab you can create the filter on which to base the condition. Using the Properties tab you can define the effects of this condition, for example, change the font colour.

  3. From the Filter tab, click Edit, create the filter to apply to the variable then click OK.

    TIP: If you are using Report Designer v1.3 or above and your filter is too complex for the Modify Filter window, click Use Advanced Filter, enter the filter in the Expression Editor window then click OK. You can check your Report Designer version in Help > About > Application > File Version.

    For further information about building filters, please refer to the following article.

    NOTE: When using dates within conditional formatting, you must enter the date in the format #yyyy/mm/dd#, for example, #2010/05/13#.

  4. Click the Properties tab and set the properties to apply when the condition is met. For example, to show any values in red, expand the Text Style option and from the Color drop-down list, choose Red.

    TIP: The preview pane indicates how the object appears when the condition is met.

  5. To confirm the conditional formatting, click OK.

  6. If required, to apply conditional formatting to further variables repeat the above steps.

You have now applied basic conditional formatting to objects on your report. You should make any further required changes and then save your report. For further information about saving your report, please refer to the section To save the changes to your document later in this article.

To apply advanced conditional formatting to a variable

NOTE: Before following the steps in this section you should check that Report Designer is set to use advanced conditional formatting. For further information, please refer to the section Basic and advanced conditional formatting earlier in this article.

  1. Locate and select the variable to which you want to apply the conditional formatting, for example, SLCustomerAccounts.AccountBalance.

  2. From the Properties pane, select Conditional Formatting then click the finder button .

  3. In the Expression Editor window, enter your conditional formatting expression, then click OK.

    For information about the syntax used in advanced conditional formatting, please refer to the following section.
Syntax guide for advanced conditional formatting

When Advanced Conditional Formatting is selected, the Conditional Formatting window is replaced by the Expression Editor window which requires the condition to be entered as code. The code uses the following format:

if condition to be met, for example, SLCustomerAccounts.AccountBalance > SLCustomerAccounts.CreditLimit 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 (SLCustomerAccounts.AccountBalance > 1000 and SLCustomerAccounts.AccountBalance <= 5000) then

begin
TextStyle->Color := NamedColor("DarkOrange");
end

else

if SLCustomerAccounts.AccountBalance > 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";
To save the changes to your document
  1. To save your changes, you must change the name and description of your document. To do this, open the Report menu, choose Report Properties, enter a new name and description for the document then click OK.

    Report Designer v1.3 and below - To save your changes, you must change the name of your document. To do this, from the Report Explorer pane, select the document name. From the Properties pane, in the Name box, enter your preferred description for the document then press Enter.

  2. To save the changes, open the File menu and choose Save As. From the Save As window, in the File name box, enter a file name for your amended document. If required, browse to the required location for your document then click Save. For further information about where to save your document, please refer to the following article.

  3. To close Sage Report Designer, open the File menu and choose Exit.

You have now saved your amended document.

NOTE: If you are viewing this article from the Sage website, a list of Sage 200 Report Designer articles are now available.


Sage Business Partners can now log new cases online!

If you're unable to find the help you require from our online resources, log a new case with us without having to use phone or email. Simply select 'Manage your cases' from the dashboard or visit my.sage.co.uk/cases.


Sage 200 Services

Did you know Sage 200 customers now have access to a range of services direct with Sage. These include a bespoke Report Design Service, a library of How to Webinars and Ideas Portal just to name a few. Explore your potential using Sage 200 Services.


Steps to duplicate
Related Solutions