组内每隔 5 行加一个分隔线

【问题】

I have grouped the data on the column “state” and set the pagebreak option to “Always Excluding First” so that I can see the data related to a particular state in a separate page.

I’m trying to add a horizontal line after every 5 rows in the group. How can I do that??

I tried to add a line and set the visibility property to “Hide Element”, selected the radio button “For specific output” and wrote the expression "Birt.Math((row._rownum+1),5)!=0". At first, it looked like a solution, but for the next group, the rownum is not “zero”.

http://www.birt-exchange.org/org/forum/public/style_emoticons/ default/confused.gif How can I reset the “rownum” to zero for every first row in the group so that I can see the horizontal line after every 5 rows(starting from the first row in that group, but not the first row in the table) in the next groups?

To say it more clear, if I have 2 groups and in the first group(which is in the first page) I have 17 rows. In the second group (which is in the second page), I have 18 rows. When I tried to add the expression for the visibility(mentioned above), I could see the horizontal line for every 5 rows in the first page. But in the next page, I can see the horizontal line after 3 rows(and not after 5 rows). This is because of the rows 16,17 in the first group and the rows 18,19,20 in the second group. I want to reset the rownum to zero for the first row of every group.

cities 表:

stateid cid Name
42 52 Memphis
42 56 Nashville
43 49 Arlington
43 54 El Paso
43 4 Houston
43 8 Dallas
43 9 San Antonio
43 15 Austin
43 20 Paso
43 24 Fort Worth
43 72 Corpus Christi
43 78 Plano
43 94 Garland

【回答】

使用报表脚本重置组内序号有点麻烦,这类问题可以通用地在数据源准备阶段用集算器 SPL 加计算列的方式解决:

方法一:在组内每隔 5 行设一个标签

A
1$select stateid,cid,Name,0 as rowmark from cities
2>A1.group(stateid).run(~.step(5,5).run(rowmark=1))

结果如下:

方法二:添加组内序号

A
1$select stateid,cid,Name,0 as rownum from cities
2>A1.group(stateid).run(~.run(rownum=#))

结果如下:

BIRT 可通过 JDBC 访问集算器,可以像数据库一样使用,参考Java 如何调用 SPL 脚本

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值