简体   繁体   中英

alternate row color and Can Grow field in Crystal Reports

In my report each row contains many fields and one of them is set to Can Grow. I have alternate row color for easier row separation with a fomula like if recordnumber mod 2 = 0 then crTeal else crNoColor . However because the Can Grow field takes up multiple lines my alternate colors mess up. Any idea how I can overcome this problem?

Not sure if the Can Grow field is the problem after all. Sometimes I have for 2 or 3 rows the same color.

I have 3 groups like Products, status of Product (sold out etc..), Customer. I had to make a group for Customers because I wanted the latest date of a field and I read that this is a way to do it.

Problem is not with can grow...problem is with the formula.

When you have huge data and many groups then row number will generate the number which is not necessary the serial number and when you do modulus on that result will be one that you got.

Try this solution

Create a formula @initialise place in a section that is above the section where you show data

Shared numbervar counter;
counter:=0;

Create formula @count place in section where you show data

Shared numbervar counter;
counter:=counter+1;

Create a formula @reset place in a section after the section where you display the data

Shared numbervar counter;
counter:=0;

Now write your formula as

Shared numbervar counter;

 if counter mod 2 = 0 
then crTeal 
else crNoColor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM