ireport 分组求和

在ireport中实现分组,求和。效果如下
    name   total
     A       2
     A       3
   subtotal  5
     B       4
     B       5
    subtotal  9
添加Document-->Variables-->Variable Name 建立自定义的求和函数
设置相关属性。
Calculation 设置为sum
reset type为report
Reset group 选择自己创建的分组。
increment type 为Group
Variable Expression填写你要累计的对象表达式。 new Integer($F{rxNo})
Initial Value Expression处填写数据类型的初始化对象。 new java.lang.Integer(0)

通过上面设置,发现不能成功。应该将 increment type 设置为None.就可以实现了。

如果要计算每个分组有多少条记录,则将increment type设置为group.calculationType为count

猜你喜欢

转载自flrldeye.iteye.com/blog/1766997