beautypg.com

Conditional attribute properties – HP Intelligent Management Center Standard Software Platform User Manual

Page 350

background image

Conditional attribute properties

A conditional attribute property tests to see which of two or more conditions
is met. The program then applies the formatting appropriate to the condition.
For example, assume that you want values under quota printed in red and
all other values printed in black. The program tests to see whether the value
is under quota or not. If it is under quota, then it applies the red attribute; if
it is not, then it applies the black attribute.

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

Crystal syntax example

If Condition A Then

crRed

Else

crBlack

Basic syntax example

If Condition A Then

formula = crRed

Else

formula = crBlack

End If

When conditional attribute properties are set up, Crystal Reports loads a
selection of attributes into the Functions list in the Formula Workshop.
Double-click any of these attributes to add them to a formula. For example,
if you are setting horizontal alignment conditionally, the Functions list contains
attributes such as DefaultHorAligned, LeftAligned, and Justified. If you are
setting borders conditionally, the Functions list contains attributes such as
NoLine, SingleLine, and DashedLine.

Note:

Always include the Else keyword in conditional formulas; otherwise, values
that don't meet the If condition may not retain their original format. To retain
the original format of values that don't meet your If condition, use the
DefaultAttribute function.

350

Crystal Reports 2008 SP3 User's Guide

Formatting

13

Working with conditional formatting