Alternate shading of rows

I am trying to shade the rows on each section. The first row of each section needs to be shaded for example:

State
City
Province
DataRow1
DataRow2
DataRow2
State1
City1
Province1
DataRow1
DataRow2
DataRow2

So for each section the first row needs to be shaded. Does anyone have any ideas how I can achieve this. Thank you.


richford (BOB member since 2008-07-18)

There are a couple ways to do it, but we need to know in what kind of sections you have your data. Is everything in Details sections, everything in Group sections, are some records in Groups and some in Details? Your example confused me a bit - did you mean …

Group Header: State 1
City 1
Province 1
Details: DataRow1A
DataRow1B
DataRow1C
Group Header: State 2
City 2
Province 2
Details: DataRow2A
DataRow2B
DataRow2C


Chamsin :us: (BOB member since 2008-06-05)

Sorry for the confusion. I’m newbie to Crystal Reporting. Yes the data that I need shaded is in the details section. Please let me know if you need any more information. Thanks!!!


richford (BOB member since 2008-07-18)

1 - Go to Report >> Section Expert.

2 - Highlight the Details section.

3 - Click on the second tab labeled “Color”.

4 - (This step is to find the color mixture you want to use - some of the stock colors are too strong - this will give you control over the exact color and color depth). Click the checkbox for Background Color; use the dropdown and select “More”; use the color palette to select the color mix and the slider bar to its right to select the color intensity; jot down the numbers for Red, Green, and Blue for use in a formula then cancel the Color screen.

5 - To the right of the color dropdown arrow, click on the X+2 conditional formatting button.

6 - Enter the following formula:

IF Remainder (RecordNumber, 2) <> 0
THEN Color (158, 254, 160)
ELSE crNoColor

7 - (The numbers in the Color function were mine for a light green). Save and close the formula editor screen, and OK out of Section Expert.

The principle of this formula can be used (with some changes) for alternating group backgrounds and even some other things, so take note of it.


Chamsin :us: (BOB member since 2008-06-05)

Could someone please tell me what the changes are that have to be made when we’re talking about a group? Obviously RecordNumber won’t do the trick, but I’m not able to figure out what does. Or is it GroupNumber?


wahey :netherlands: (BOB member since 2007-05-31)

Instead of recordnumber you can probably use a running total that is reset on change of group. That would make the first record of every group 1 and the second 2. You can keep a more consistent look from group to group when you use a running total this way instead of a total record count.


tbrady (BOB member since 2007-09-25)