Skip to Content
0
Jun 28, 2020 at 09:24 AM

Crystal Reports colouring

124 Views

crystal.png

I have created a Crystal Report (V11) that is producing the correct information. The issue is colouring of alternate records.

It is a very simple report using the report wizard and it only has one selection formula in addition to picking the fields I want displayed.

The report is correctly showing only Open records, this is my select statement that filters out the Closed items.

Not (isnull({CCM_MASTER_2_ACT.CLOSED}))

I have created a Counter to keep track of the record numbers, it works(I probably don’t need it though). I want record 1 to print in white and record 2 to be blue, then record 3 white and record 4 blue etc. This works fine up to the point that non-filtered records are no longer divisible by two so my formula results in consecutive records printing in wrong colour.

This is my counter formula

Shared NumberVar counter;

counter:=counter+1

In my Section Expert, Details, colour I have the following

if {@Counter} mod 2 = 0 then crSilver else CrNoColor

I have attached to this message a file displaying the problem. In the right hand column U will see that numbers 21 and 25 are printed in white because the record number divided by two has a remainder in both cases. Records 22, 23 and 24 were supressed

I have tried using a Remainder formula but I get the same result

if Remainder(RecordNumber,2) <> 0 then crBlue else crWhite

Ideally the Counter would be created after the select statement has removed the Open items, how can I do this or is there some other better way?

Thanks

Attachments

crystal.png (9.9 kB)