Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Different look of even/odd rows in detail section Post Reply Post New Topic
Author Message
Dawton
Newbie
Newbie
Avatar

Joined: 18 Jan 2008
Online Status: Offline
Posts: 6
Quote Dawton Replybullet Topic: Different look of even/odd rows in detail section
    Posted: 18 Jan 2008 at 2:56am
Hello,
please does anyone know how to make different look of even/odd rows in detail section? I want to swap 2 background colours - or display/hide a colour rectangle to have "color/white" look.
Thanks for hints
*D.
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 18 Jan 2008 at 5:24am
Go to the Section Expert.
Go to the section you want to color (presumably Details).
Go to the Color tab on the right-hand side.
Check Background Color on.
Click on the "x-2" button next to the color selector.

The formula should look like:

If RecordNumber mod 2 = 0 Then
crSilver
Else
crWhite

(Obviously, replace the colors with whatever you like.)

The modulo operator returns the remainder when the first number is divided by the second number.  So, "RecordNumber mod 2" returns 0 on even records, and 1 on odd records.

This can be expanded to similar effects.  So, to get a "greenbar" effect, in which the color changes for groups of five records, use:

If RecordNumber mod 10 >= 5 Then
crGreen
Else
crWhite


IP IP Logged
Dawton
Newbie
Newbie
Avatar

Joined: 18 Jan 2008
Online Status: Offline
Posts: 6
Quote Dawton Replybullet Posted: 05 Feb 2008 at 11:46pm
This works perfect!
Now I'm trying to find out how to change rectangle fill-colour depending on row number. I cannot find that magic button "x-2" in rectangle properties.
Am I blind? Or is there any chance to do it?
Thanks
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 06 Feb 2008 at 12:13am
True, the rectange doesn't have a formula button for the color (or any of the other properties). One trick would be to use an empty textbox as the rectange. Set the background color using a formula, and to make sure that it prints under the other report objects, set it to Move > To Back. 
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.078 seconds.