The steps below detail how to use Crystal Reports to make fields apply formatting on a condition.
For example, if the amount is $0.00 – red, if more than $1,000 – green otherwise use default font colour.
- Right-click on the field and select ‘Format Field’
- Open the ‘Font’ tab
- You’ll notice against each option there’s a formula button – you can use these to apply formulas that override the default formatting
- In this example we’ll be setting colours, so click on the formula button for the colour option
- The formula editor will open. You’ll notice that there are instructions added to the formula which detail all the colour options.
- To set the colour red when the field is $0.00 or green when more than $1,000 use the following formula
-
if {fieldname} = 0 then crRed else if {fieldname} > 1000 then crGreen
- You’ll now find the field changes colour according to your formula.