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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternating Rows in a Cross Tab Report

Status
Not open for further replies.

wanzek

Technical User
Mar 8, 2010
58
US
I know that there are several other thread with suggested formulas but I must be missing a step because it never seems to work correctly.
I have tried this formula for the row labels:
whileprintingrecords;
numbervar d;
d:= if d = 200 then 255 else 200;
color(200,d,200)
and for the inner cells:
whileprintingrecords;
numbervar c;
c := if c = 255 then 200 else 255;
color (200,c,200)
My cross tab report is placed in a Group Header #2. Everytime the #2 group changes there is a total a new cross tab report starts. These formulas above work on the first cross tab report but on the second report the highlighting is per row it appears that each cell does it own thing.
 
I think there has to be an even number of rows for this to work properly. What are your row, column, and summary fields?

-LB
 
My rows are employee names (string), my columns are posting dates (DateTime fields), and my summary fields are the number of hours worked for each employee during the date posted.
 
The following seems to work. Please be careful about putting the colons (or not) in the right places:

For the inner cells:
whileprintingrecords;
numbervar c;
if c = 0 then
c := 200 else
if c = 255 then
c := 200 else
c := 255;
color(200,c,200)

For the report header AND the group footer:

whileprintingrecords;
numbervar d;
if remainder(distinctcount({table.employeename}),2) = 0 then
d := 200 else
d := 255;

For the row labels:

whileprintingrecords;
numbervar d;
if d = 200 then
d := 255 else
if d = 255 then
d := 200;
color(200,d,200)

The only caveat is that if a specific crosstab crosses pages, the alternating gets messed up.

-LB
 
That is the problem I am having my crosstab does cross pages and after the first page the formula no longer works. Any idea what I could use so this doesn't happen?
 
You could try resizing the crosstab by unchecking "show cell margins" in the customize style tab. This might work if the crosstabs are only a little longer than one page right now. Otherwise, I don't know of a fix, other than to use a manual crosstab instead of an inserted one.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top