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!

Crystal Report CrossTab Summary Heading color 1

Status
Not open for further replies.

shadabmustafa

Programmer
Apr 7, 2011
4
PK
Hi,

I've a report with cross tab with one group in rows and 2 groups in columns. I'm trying change the color of columns based on the value of first group of column. This column values will be always "Identified", "Cleared" and "In Progress".

I've formatted the background of the columns like this and it works fine.

IF gridrowcolumnvalue("Command.STATUS") = "Cleared" THEN crGreen
ELSE IF gridrowcolumnvalue("Command.STATUS") = "Identified" THEN crRed
ELSE IF gridrowcolumnvalue("Command.STATUS") = "In Progress" THEN crBlue

But the problem that I'm unable to resolve is that heading of "Total" is not being colored with the same color of the column.
 
Select the column#1 label->format field->border->color->background->x+2 and enter:

whileprintingrecords;
numbervar x :=
IF gridrowcolumnvalue("Command.STATUS") = "Cleared" THEN
crGreen ELSE
IF gridrowcolumnvalue("Command.STATUS") = "Identified" THEN
crRed ELSE
IF gridrowcolumnvalue("Command.STATUS") = "In Progress" THEN
crBlue

Then select the Total column (this is really the total for column#2)->format field->border->color->background->x+2 and enter:

whileprintingrecords;
numbervar x;

-LB
 
Thanks LB for your reply.

I'd tried it earlier and it was giving a strange output, perhaps due to the hierarchy of printing records.

What actually happening is, these columns are printed in this order.

1. Cleared(Green) 2. Identified(Red) 3. In Progress(Blue)
Total under Cleared is colored in Red
Total under Identified is colored Blue
and Total under In Progress is Black

Any work around? Your reply is greatly cherished. :)
 
Do you have your totals at the top or at the bottom? I tested this and it worked for me, with a layout like this:

Region 1 Region 2
Total City1 City2 City3 Total City1 City2 City3
100 25 50 25 200 100 75 25

//etc.

The color formula goes in the Region label formula area. Can you verify that you took this approach or explain what you did differently?

-LB
 
Thanks again for your reply LB.

I did exactly same with difference of position of total column. You've put the total column on left and I've to put it on the right.

No issues with the grand total on the bottom of the CrossTab. Its showing exactly how I want it to.

Identified Cleared In Progress
C1 C2 C3 Total C1 C2 C3 Total C1 C2 C3 Total
Cause1 2 3 1 6 1 0 3 4 2 1 1 4
Cause2 0 1 2 3 0 1 2 3 3 1 2 6
Total 2 4 3 9 1 1 5 7 5 2 3 10

I hope I've made my point clear?

Shadab
 
I haven't tested this with the changed position, but I see no reason why my earlier suggestion wouldn't still work. Can you please verify the exact steps you took, showing the formulas you used and where you placed them?

-LB
 
Okay, I tested this and got the same results as you. The following worked. Format column#1 labels ONLY with this formula:

whileprintingrecords;
numbervar x;
numbervar prev := x;
IF gridrowcolumnvalue("Command.STATUS") = "Cleared" THEN
x := crGreen ELSE
IF gridrowcolumnvalue("Command.STATUS") = "Identified" THEN
x := crRed ELSE
IF gridrowcolumnvalue("Command.STATUS") = "In Progress" THEN
x := crBlue;

For the Total column label (next to the Column #2 values), format the background color with this formula:

whileprintingrecords;
numbervar prev;

For ALL other cells use this formula:

IF gridrowcolumnvalue("Command.STATUS") = "Cleared" THEN
crGreen ELSE
IF gridrowcolumnvalue("Command.STATUS") = "Identified" THEN
crRed ELSE
IF gridrowcolumnvalue("Command.STATUS") = "In Progress" THEN
crBlue;

This worked when I tested it.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top