Crystal Reports - Conditional Formatting



To write a conditional formatting formula, right-click the report and click Format Result Object element → select the property on which you want to apply conditional formula → click and it will open formula workshop.

Write the formula in the formula text pane, save and close it.

Conditional Formatting

In this example, if you can print Total Price greater than 60000 in Green and below 60000 in Red, this can be passed in formula workshop.

Formula Example

Formula Example2

In this example, crGreen, crRed, crBlack is used. You can also use actual numeric value of color constants.

There are three common conditional formatting functions −

  • CurrentObjectValue
  • DefaultAttribute
  • GridRowColumnValue

DefaultAttribute can be used for any formatting formula, CurrentObjectValue for any formatting formula where you are formatting an object value, and GridRowColumnValue can be used for any formatting formula where you are formatting an object value in a Cross-Tab.

Advertisements