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

conditional format (change font color) based on group footer field

Status
Not open for further replies.

jrhessey

IS-IT--Management
Feb 25, 2005
37
0
0
CR 8.5 is the version I'm on. What I have is a database of baseball players and would like to format the players sums and averages so that if they are in the top 3 color the font red or whatever. I have 2 groups, g1 is stats.player and g2 is stats.opponent. The avg field for example for the player totals section is this...

Sum ({Stats.H}, {Stats.Player})/Sum ({Stats.AB}, {Stats.Player})

It's set up like this...

Player name
Opponent
detail section
totals for opponent
totals for player - this is the section I want to format conditionally

I thought there was a way to do this via running totals, but can't figure it out.

Thanks for any help!
 
Create two SQL expressions:

[{%sum1}:]
(
select Sum (A.`H`)
from Stats A
where A.`Player` = Stats.`Player`
)

[{%sum2}:]
(
select Sum (A.`AB`)
from Stats A
where A.`Player` = Stats.`Player`
)

Then create a formula {@ave} in your main report:

{%sum1}/{%sum2}

Place this in the detail section and insert a maximum on it at the player group level. Then go to report->topN/group sort and choose sort All->{@ave}->descending.

Then go into the section expert->GF#1->color tab->background->x+2 and enter:

whileprintingrecords;
numbervar cnt := cnt + 1;

if cnt < 4 then
crRed else crNocolor

If you want to just color the font or specific fields rather than the whole section, you can right click on the field->format field->borders->color->background->x+2 and enter the same formula or go to the font tab->color, etc.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top