简体   繁体   English

Crystal Reports中的备用行颜色和“可以增长”字段

[英]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 . 我有备用的行颜色,以便使用公式更容易地进行行分隔,例如, 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. 有时我有2或3行相同的颜色。

I have 3 groups like Products, status of Product (sold out etc..), Customer. 我有3个小组,例如“产品”,“产品状态”(已售完等),“客户”。 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 在显示数据的部分上方的部分中创建公式@initialise位置

Shared numbervar counter;
counter:=0;

Create formula @count place in section where you show data 在显示数据的部分中创建公式@count位置

Shared numbervar counter;
counter:=counter+1;

Create a formula @reset place in a section after the section where you display the data 在显示数据的部分之后的部分中创建公式@reset位置

Shared numbervar counter;
counter:=0;

Now write your formula as 现在将公式写为

Shared numbervar counter;

 if counter mod 2 = 0 
then crTeal 
else crNoColor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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