Print Page | Close Window

Adding colors to the detail

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=13459
Printed Date: 27 Apr 2024 at 8:13am


Topic: Adding colors to the detail
Posted By: herman
Subject: Adding colors to the detail
Date Posted: 09 Jun 2011 at 9:51am
How do I add color to every other detail or every other row of details?  Is there a way to do this?
 
Thanks,
Carl



Replies:
Posted By: DBlank
Date Posted: 09 Jun 2011 at 9:55am
if you are not suppressing any rows
 

If (Recordnumber Mod 2 = 0) Then Color (R,G,B) Else crNocolor;

 

othwise you need a RT to get the value for each row (a counter)

If ({#RT} Mod 2 = 0) Then Color (R,G,B) Else crNocolor;



Posted By: herman
Date Posted: 09 Jun 2011 at 10:13am
I'm not able to get this to work.  I'm trying it in the section expert under color.  Is that right?
 
I keep getting "The ) is missing" right after the R of (R,G,B).


Posted By: herman
Date Posted: 09 Jun 2011 at 10:20am
I got it.  I changed the formula to the follow:
 
If (Recordnumber Mod 2 = 0) Then crSilver Else crNocolor


Posted By: DBlank
Date Posted: 09 Jun 2011 at 10:25am
yes
the COLOR() allows you to control the color using RGB values
I generally use COLOR(236,242,242) as a more subtle version of crsilver


Posted By: CircleD
Date Posted: 09 Jun 2011 at 2:30pm
You can also use:
select RecordNumber mod2
case 0:crWhite
case 1: color(225,225,225)
default: crWhite //this line is optional

Or you can apply it for groups by changing it to

select GroupNumber mod2
case 0:crWhite
case 1:color(225,225,225)
default: crWhite //this line is optional

If you want to do 2 lines at a time then:

If Remainder(RecordNumber, 4) In [1,2] Then crSilver
Else NoColor



Print Page | Close Window