Conditional Formatting

You can use expressions to manipulate some style properties of a report item.

When not using the conditional expression dialog provided with SunSystems, these expressions are generally written using the IIF logical function. The syntax for this function is:

IIF(logical_test,value_if_TRUE,value_if_FALSE)

Where

  • logical_test is any value or expression that can be evaluated to TRUE or FALSE
  • value_if_TRUE is the value that is returned if logical_test is TRUE.
  • value_if_FALSE is the value that is returned if logical_test is FALSE.

For example, you can write an expression for the Color property of a text box that displays the data in a different color depending on the data.

Example 1

This expression, used in the Color property of a text box, displays the value in red if the value in the Cost field is greater than the value in the Revenue field. If the condition is not met, the value appears black:

=IIF(Fields!Cost.Value>Fields!Revenue.Value, "Red", "Black")

Example 2

This expression, used in the Background Color property of a Detail section, displays the rows alternately in Grey and White stripes.

=IIF(RowNumber(Nothing) MOD 2, "Grey", "White")

Other formatting properties that support conditional formatting include Font Family, Size, Style and Text Decoration.