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

Format Crosstab rows

Status
Not open for further replies.

rdeleon

IS-IT--Management
Jun 11, 2002
114
US
I am using CR 11 and have a crosstab with the information I need, but I was hoping there was a way to conditionally format a particular crosstab row.

Here is what I have:

Type1 Type2
SubType1 SubType2 SubType1 SubType2
Row1 2/10/05 2/10/06
Row2 3/1/06 3/1/06
Row3 4/1/06 4/2/06
Row4 5/1/06 5/1/06

Is there any way to conditionally format Row3 (bold,red) because the values are not equal?

The summary is Max for a date field

Any help is appreciated.

Rene'

 
This solution requires that you have a group on your main report for the row field so that you can use the group condition in a formula. The group can be suppressed. Let's say your row field is {table.ID}.

First create two commands (database->database expert->your datasource->add command:

Select max(table.`date`) as maxdate, table.`ID`
From `table` table
Group by table.`ID`

Link the command to the main table on {table.ID}.

When you are done, select the table in the table list->press F2 (function key) and then change the name of the command to "maxrow".

Then create the second command:

Select max(table.`date`) as maxdate, table.`ID`, table.`type`,table.`subtype`
From `table` table
Group by table.`ID`,table.`type`,table.`subtype`

Link this command to the main table on {table.ID},{table.type}, and {table.subtype}. Change the name of this command to "maxrowcol".

Then create a formula {@flag}:
if maximum({maxrow.maxdate},{table.ID}) <> minimum({maxrowcol.maxdate},{table.ID}) then true

Add {@flag} as a summary in your crosstab and drag it so that it is the topmost summary (it must be in this position, because you are going to create a running total in the crosstab). In preview mode, change the summary for {@flag} from count to maximum.

Then select the new summary in the crosstab->format field->common->suppress->x+2 and enter:

whileprintingrecords;
booleanvar flag := currentfieldvalue;
true

Drag the top/bottom borders of this summary to minimize its height.

Next select the date summary->format field->border->color->background->x+2 and enter:

whileprintingrecords;
booleanvar flag;
if flag = true then
crYellow else crNoColor

This should color the entire line when one value in the line doesn't match the others.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top