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!

Highlight crosstab field background based on another field 1

Status
Not open for further replies.

Gus01

Programmer
Sep 4, 2009
45
FR
Hello,

In a crosstab, how do I change the background color of a field based on another field.
For example: Table(Year, Label, Value, State)

The crosstab is: Column=Year, Row=Label, Field=Value
2008 2009 2010
Label1 val1 val2 val3
Label2 val4 val5 val6

The formula on the field {Table.Value} is:
If {Table.State} = 0 Then crRed Else crBlue


Thank you for your help
 
You would need to add {table.state} as your first summary, and {table.value} as the second one. Then in preview mode, select the state summary->right click->format field->suppress->x+2 and enter:

whileprintingrecords;
numbervar st := currentfieldvalue;
true

Then select the value summary->right click->borders->color->background->x+2 and enter:
whileprintingrecords;
numbervar st;
if st = 0 then
crred else
crblue

Note that if you want this to apply to totals, select the corresponding total along with the inner cell when you set up the condtional formulas.

Your final step would be to minimize the height of the suppressed state summary.

-LB
 
Great !
Before posting, I had tried without success by adding {table.state} to the crosstab but I didn't know the tips for formatting the crosstab.

Now it works !
Clever tips, thank you LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top