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

Alternate Row Color in a Crosstab 1

Status
Not open for further replies.

Osangar

IS-IT--Management
Nov 21, 2005
3
CA
I am looking for a way to alternate the row colors on my crosstab report (Crystal 10). I have used the following to do this with regular records:

if Remainder (recordnumber,2) = 0 then crGrey else crGreen

but this formula will not work in a crosstab. I have then tried to do a count formula for the row field, and then inserted into above formula:

Count ({Product.ProductName}

if Remainder ({@Count,2}) = 0 then crGrey else crGreen

This does not seem to work either, any ideas out there.
 
Assuming that {Product.ProductName} is your current row field, create a formula {@number}:

whilereadingrecords;
numbervar cnt;
stringvar product;

if instr(product,{Product.ProductName}) = 0 then
(product := product + {Product.ProductName};
cnt := cnt + 1);
cnt

Add this to your crosstab as your topmost row field. Then to format this number, right click on it->format field->border->color->background->x+2 and enter:

if remainder(val(CurrentFieldValue),2)= 0 then crGray else crGreen

Then for the label for productname and for inner cells and totals, use a formatting formula like:

if remainder(GridRowColumnValue ("@number"),2) = 0 then crGray else crGreen

-LB
 
Thank you very much lbass, I actually saw your other reply to a related question back in July and I have applied it to my report. Tried to edit my post to reflect the older post.

Question though - since a row label has been applied concatenating the count with the product name; my rows are now sorted with 10 being the first record and 1 being the eleventh record and 19 being the tenth record in my crosstab. This has left my tenth and eleventh record as green rather than alternating. Any solutions to this?
 
If you are going to use a concatenation of the cnt and name instead of a separate row field, then when formatting cnt to text, use:

totext(cnt,"00")

...adding zeros to reflect the maximum number of places you expect in the numbering. Not sure how you are getting that odd sorting (10,19,1). Maybe you should post your formula and also indicate what your row fields are.

-LB
 
Sorry, I see I have missed a step.
Thank you for your help, it has been invaluable.
 
Hello:

Thank you very much lbass, I tried the above formula, but it did not alternate every other row a different a color, which I would like, but grouped the first five green, then gray.

How can I get each row to alternate?

Thank you,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top