beautypg.com

HP Intelligent Management Center Standard Software Platform User Manual

Page 351

background image

Crystal syntax example

If Condition A Then

crRed

Else

DefaultAttribute

Basic syntax example

If Condition A Then

formula = crRed

Else

formula = DefaultAttribute

End If

You can take this kind of property one step further. You can specify a list of
conditions and a property for each; you are not limited to two conditions. For
example, if you have a number field on your report that contains sales figures
from countries around the world, you can specify the number attribute(s) that
you want to apply to each country. In this case, your conditions would specify
that if it is from Country A, the program should apply the Country A attribute;
if it is from Country B, the Country B attribute; if it is from Country C, the
Country C attribute, and so on.

With more than two alternatives, use this kind of formula:

Crystal syntax example

If Condition A Then

crRed

Else If Condition B Then

crBlack

Else If Condition C Then

crGreen

Else

crBlue

Basic syntax example

If Condition A Then

formula = crRed

ElseIf Condition B Then

formula = crBlack

ElseIf Condition C Then

formula = crGreen

Else

Crystal Reports 2008 SP3 User's Guide

351

13

Formatting

Working with conditional formatting