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

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

Resolution

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

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

Keywords

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

Product

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