When writing a conditional formatting formula, you may want to use the additional functions that appear at the top of the Functions tree.
If you wanted to format the {Customer.Last Year's Sales} field so that sales of more than $100,000 are printed in green and sales of less than $15,000 are printed in red and all else are printed in black.
Rem Conditional formatting example 1 If {Customer.Last Year's Sales} > 100000 Then formula = crGreen ElseIf {Customer.Last Year's Sales} < 15000 Then formula = crRed Else formula = crBlack End If
Since this is a font color formatting function, the list of Color Constants appears in the Functions tree. This example uses three: crGreen, crRed and crBlack. You could have used the actual numeric values of the color constants instead. For example, crRed is 255 and crGreen is 32768. However, the formula is easier to understand using the color constants. All constant functions in Basic syntax have the "cr" prefix.
Note: Some formatting attributes do not use constant functions. For example, if you wanted to not print {Customer.Last Year's Sales} values if the sales were less than $50,000, you could write the following conditional formatting formula for the suppress attribute:
Rem Conditional formatting example 2 If {Customer.Last Year's Sales} < 50000 Then formula = True 'suppress the value Else formula = False 'do not suppress the value End If
Rem Conditional formatting example 3 - Rem equivalent to example 2 formula = {Customer.Last Year's Sales} < 50000
If the last year's sales are less than $50,000, then the expression
{Customer.Last Year's Sales} < 50000
is True, and so the formula returns True. On the other hand, if the last year's sales are greater than or equal to $50,000, then
{Customer.Last Year's Sales} < 50000
is False and so the formula returns False.
Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com |