Print Page | Close Window

Background Color change in Detail Section

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=5666
Printed Date: 27 Apr 2024 at 10:45am


Topic: Background Color change in Detail Section
Posted By: aeromonte
Subject: Background Color change in Detail Section
Date Posted: 03 Mar 2009 at 12:24pm
Anyone know how I would have the background color change in the Detail section when a record changes?? 
 
Example: I have multiple quotes and multiple lines per quote - I would like the background color in the detail section to alternate between white and gray when a new quote starts (so all the lines per quote are colored the same as the quote they belong to).
 
Thanks
John



Replies:
Posted By: DBlank
Date Posted: 03 Mar 2009 at 12:54pm
Having a little trouble understanding your set up. Can you post the set up to explain it?  Example: Do you have multiple detail sections or one detail section?


Posted By: aeromonte
Date Posted: 03 Mar 2009 at 1:00pm
Just one detail section.  Example:
 
123456 (quote 1)  Line1 
123456                  Line2
123456                  Line3
 
123457 (quote 2)  Line1
 
123458 (quote 3)  Line1
123458                 Line2
 
Want the background color of the detail section to change when a new quote number changes example: from 123456 to 123457
 
Does that make sense?
Thanks!


Posted By: DBlank
Date Posted: 03 Mar 2009 at 1:39pm
Still looks like this is just expanding your row size to accomodate the full quote or do you have 3 seperate data items for quote one?
If it is just expanding you can do a conditional highlight on every other record by going to Section expert, click on Details then the color tab and insert the formula:
If (RecordNumber Mod 2 = 0) Then crSilver Else DefaultAttribute;
 
reference to
http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=3106 - http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=3106
Does this do it or are there 3 distinct rows for quote 123456?


Posted By: Savan
Date Posted: 04 Mar 2009 at 1:02am
you can create a running total field say "totrec" and place this in detail section and supress it. while creating the running total field in the evalute option select the "use a formula" write the below formula

previous(<filedname>) <> (filedname) (this filed name which contains the data 123456,123457 of your table).


Now in the section expert of detail section, select the color tab and check the background color. In the formula you can write the following code.


if {#totrec} mod 2 = 0 then
crblue
else
crwhite;

-------------
Thanks
Savan


Posted By: aeromonte
Date Posted: 04 Mar 2009 at 5:36am

Yes, each Line (with repeating quote number) is a new row (detail section record)

Savan, this worked perfectly!!!  Thanks so much!! 
 
I just named the new running total field "ColorChange", instead of "totrec", so I will remember what it is in the future.  I also changed the background color, because the blue was too dark.
 
Now when the quote number changes, the color alternates back and forth.  All the lines associated with each quote number are the same color as the quote they belong to.
 
Thanks again!



Print Page | Close Window