Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternating Group Background Colors 1

Status
Not open for further replies.

jakecolman

IS-IT--Management
Apr 2, 2006
54
US
Using Crystal Reports XI on Oracle 9.

My report has 3 groups and a detail section. G1 is standalone. The data in G2,G3,D,F3,F2 is considered a related section. I want to change the background color of every alternating related section so that the sections are visually offset from each other.

I know that using the Section Expert I can specify the background color via a formula. How do I create a formula that specifies a background of white for the first section, silver for the second, and then alternating back and forth for how ever many sections appear?

TIA!

...Jake
 
Create a formula in GH1 of:

whileprintingrecords;
numbervar Colorize := 1

Then in each of the sections background color formulas place:

whileprintingrecords;
booleanvar Colorize;
Colorize := Colorize * -1;
If colorize > 0 then
crsilver
else
crwhite

-k
 
It may be simpler to use
Code:
IF Remainder(GroupNumber,2)=0 THEN crSilver ELSE crNoColor
to achieve the same thing.

- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido,

synapsevampire is correct. The intent here is to alternate the background color so that each section is visually offset.

I tried your solution and it is pretty slick ....but...

I entered the forumula for G2, G3, D, F3, and F2. Since the formula executes for each one, it alternates the backgorund for each one. This may be what I asked for but is not what I meant! :)

Each set of 'G2, G3, D, F3, and F2' should have the same background color. Only when G2 changes to a new group, should the backgound color change,

Is there a way to do this?

Thanks again!

...Jake
 
Then I think that Ido was closer.

Create a formula in the Report Header of:

whileprintingrecords;
numbervar Colorize := 1

Then in the GH2 section background color formula place:

whileprintingrecords;
booleanvar Colorize;
Colorize := Colorize * -1;
If colorize > 0 then
crsilver
else
crwhite

In all other sections use:

whileprintingrecords;
booleanvar Colorize;
If colorize > 0 then
crsilver
else
crwhite

Now the background color will change for all sections when GH2 changes.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top