Symptom
How to display Alternate background color in Details section based on character value
Environment
Crystal Reports 2008 (All Versions)
Resolution
Resolution 1:
- Select Report Menu -> Select Section Expert
- Select Detail section -> Select Color tab
- Select Background check box and Select Formula Button(X-2)
- 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; - Click on OK.
OR
Resolution 2:
- Create a formula in designer as follows and name it as Test 1
- Left(<Field_name>,1)
- Create a Running Total based on field and assign On Change Of value to Test1 formula
- Create another formula in designer as follows and name it as Test 2
ToText({#RTotal0} mod 2,"#") - Select Detail section -> Select Color tab
- Select Background check box and Select Formula Button(X-2)
- 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