In Crystal Reports for Blackbaud  version 6.0, you can now conditionally format
fields and sections. Conditional formatting is applied only under certain
conditions. For example, you may want the names of constituents who live in
California to print in red or cash gifts to print in bold. Conditional
formatting allows you to establish conditions that determine when the formatting
is applied. You can specify these conditions using simple formulas.

You must first understand formatting properties, which fall into two general
categories:


On or Off Properties are set using checkboxes. For example, the Suppress if
Duplicated
property is set using a checkbox. If the checkbox is marked,
the property is on, and if the checkbox is not marked, the property is off.


Attribute Properties specify one of many attributes. The font property, for
example, allows you to specify one of several fonts.

You can set both kinds of properties conditionally. However, each requires
a different kind of formula.


On or Off Properties

The program tests each value to see if it meets the condition and if it
returns a 'yes' or 'no' answer. It then applies the property to every
value that returns a 'yes' answer. This type of formula is called a Boolean.
Using the Suppress if Duplicated property as an example, let's say you want
to suppress the City field if the gift amount is less than $50.00. The
formula for this conditional statement would read:

{GIFT.EN_US} < 50.00

This formula returns a yes or no. If the formula returns a yes, meaning the
gift amount is less than $50.00, the property is turned on. In this case,
the City field will be suppressed.


Attribute Properties

A conditional attribute property tests to see which of two or more conditions
are met. The program then applies the formatting appropriate to the condition.
For example, assume you want to print gift amounts to the Annual Fund in red,
the Endowment Fund in green, and all other funds in black. The program tests
to see if the fund is the Annual Fund, Endowment Fund, or neither. If it is
the Annual Fund, it applies the red attribute. If it is the Endowment, it
applied the green. If it is neither fund, it applies the black attribute.

Use an If-Then-Else formula for this kind of conditional formatting.

if {Gift Fund.Description} = "Annual Fund" then Red

else if {Gift Fund.Description} = "Endowment Fund" then Green

else Black


When you set up conditional attribute properties, the program loads a selection
of attributes into the Functions list in the Formula Editor. You can
double-click any of these attributes to add them to your formula. For example,
if you are setting a color conditionally, the Functions list will contain
attributes such as Red, Green, Black, etc.

You can use conditional formatting to format a field or an entire section.
To format a field, highlight the field on the report, right-click, and select
Format Field. The Format Editor screen appears.


 


Click X+2 next to the particular property to enter a conditional statement.
The Format Formula Editor appears. Enter the condition in which you want to
apply the formatting.


 


If you click X+2 next to Suppress and write {CONSTITUENT.EN_US} = "SC" in the formula text window, the constituent name will be suppressed if the constituent state is equal
to SC. Suppress is an On/Off property.

To conditionally format an entire section, right-click in the section's gray
area on the Design screen and select Format Section. On the Section Expert
screen, highlight the section name you are formatting, and click X+2 to enter
your conditional statement.