分页汇总写到下一页

博主遇到一个问题,需要在报表的第二页及其后续页面显示上一页商品销售总额。解决方案是在数据处理阶段计算并合并每页的汇总值,然后利用JasperReport呈现。通过在源数据中插入上页总和,使Jasper仅需处理分页,SPL脚本可以帮助实现这一过程。
摘要由CSDN通过智能技术生成

【问题】

I need to display the previous page sum value(Amount of item sold) in the current page. If it is the first page then no need to display. From the second page onwards it should display the total sum value of the previous page at the top.

Ex : Page : 1

1.2 Product_Name Amount

Product1 100

Product2 200

Page : 2

1.3 Product_Name Amount

Pre.page_sum 300

Product3 400

Any suggestion will be helpful

【回答】

Jasper 在打印时无法取得上一页的汇总。可以在数据准备阶段把上页汇总值插入到源数据中,Jasper 就只要简单分页即可。计算每组汇总值后再与源数据按次序合并起来。用 SPL 实现这个过程比较简单:

A​
1 =$selectProduct,Amountfrom tb
2 A1.group((#-2)\(page_Row-1))
3 =A2.new(“Pre.page_sum”:Product,~.sum(Amount):Amount)
4 &
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值