SAP Knowledge Base Article - Public

1688041 - How to display Alternate background color in Details section based on character

Symptom

How to display Alternate background color in Details section based on character value

Environment

Crystal Reports 2008 (All Versions)

Resolution

Resolution 1:

  1. Select Report Menu -> Select  Section Expert
  2. Select Detail section -> Select Color tab
  3. Select Background check box and Select  Formula Button(X-2)
  4. Write the below formula in it
    Global NumberVar x := IF RecordNumber = 1 THEN 1 ELSE x;
    Global StringVar l := IF RecordNumber = 1 THEN LEFT({TableName.LastName}, 1) ELSE l;
     
    x := IF l = LEFT({TableName.LastName}, 1) THEN x ELSE x + 1;
    l := LEFT({TableName.LastName}, 1);
     
    IF x MOD 2 = 1 THEN crSilver ELSE crNoColor;
  5. Click on OK.

OR

Resolution 2:

  1. Create a formula in designer as follows and name it as Test 1
  2. Left(<Field_name>,1)
  3. Create a Running Total based on field and assign On Change Of value to Test1 formula
  4. Create another formula in designer as follows and name it as Test 2
    ToText({#RTotal0} mod 2,"#")
  5. Select Detail section -> Select Color tab
  6. Select Background check box and Select  Formula Button(X-2)
  7. Write the below formula in it
    If {@Test 2} = 1 then CrSilver else crnocolor

Keywords

Alternate background color based on alphabets, Alternate background color, background color, alternate records background color , KBA , BI-RA-CR-DSL , Crystal Reports on C++ Data Semantic Layer (ClassicUniverse) , How To

Product

Crystal Reports 2008 V1