SAP Knowledge Base Article - Public

1536790 - How to create a Crystal Report with different colors for alternate rows

Symptom

  • How to create a Crystal Report having different color for subsequent rows
  • For e.g.: In the ‘Details’ section, Row 1 would be in Blue, Row 2 would be Red, Row 3 would be again Blue and so on..

Environment

  • Crystal Reports XI R2 (All Patch levels)
  • Crystal Reports 2008 (All Patch levels)

Reproducing the Issue

  1. Create a Crystal Report against the Xtreme Sample Database
  2. Add any fields from the ‘Field Explorer’ in to the ‘Details’ section of the report
  3. Preview the report and save it locally

Resolution

  1. Open the Crystal Report created in the above step
  2. Click on ‘Report’ menu and then click on ‘Section Expert’
  3. Click on ‘Details’
  4. Click on the ‘Color’ Tab and check the ‘Background Color’ checkbox
  5. Click on the formula button and the Formula Workshop will open
  6. Create a formula as follows: 
  7. IIF(remainder((RecordNumber),2)=0,crblue,crred)

  8. Click ‘Save’ and ‘Close’ button in the ‘Formula workshop’ and refresh the report
  9. The report will have rows with alternate colors

Keywords

Alternate colored rows, Crystal Reports , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2