Skip to Content
Jul 26, 2012 at 11:26 AM

Cross-tab row formatting inconsistent



I have created a Crystal Report XI cross-tab with 3 columns.

I have built a background formula into the row header and data fields to provide alternater row background shading like the below.

This works fine when there is an even number of rows, but fails when there is an odd number of rows

In the formulas I use whileprintingrecords, and I am struggling to work out how to correct this behaviour - or even how whileprintingrecords increments the variables in these examples of even and odd rows.

My background formulas are as follows:

Row headers (e.g. July, Aug etc)

<code>whileprintingrecords;numbervar f1;f1 := iif(f1=1,0,1);iif(f1=0,color(197,217,241),color(255,255,255));</code>

'Usage' row data

<code>whileprintingrecords;numbervar f2;f2 := iif(f2=1,0,1);iif(f2=1,color(197,217,241),color(255,255,255));</code>

'%' row data

<code>whileprintingrecords;numbervar f3;f3 := iif(f3=1,0,1);iif(f3=1,color(197,217,241),color(255,255,255));</code>

'Value' row data

<code>whileprintingrecords;numbervar f4;f4 := iif(f4=1,0,1);iif(f4=1,color(197,217,241),color(255,255,255));</code>


example1.PNG (8.4 kB)
example2.PNG (5.3 kB)