将变量从一个子报表返回到 Jaspersoft Ireport 中的另一个子报表
我在 jaspersoft 中有一份主要报告。在主报告中我使用了两个子报告。在其中一份子报告中,我有一个可变的总现金。我必须在下一个子报告中使用此变量“总现金”。是否可以将变量从一个子报表传递到另一个子报表。如果不是,那么我如何将变量从子报告传递到主报告。
谢谢。
I have a main Report in jaspersoft. Inside the main Report I have used two SubReports. Inside one of the subreport i have a variable Total Cash. I have to use this variable Total Cash in my next subReport. Is it possible to pass a variable from one SubReport to another SubReport. If not then how can i pass the variable from the SubReport to the main Report.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 returnValue 元素获取从子报表到主报表的返回值。以下代码将主报告中的 $V{result} 值设置为子报告中的 $V{total} 值。这在 iReport 中比 jrxml 代码中更加明显。
请查看子报告了解更多信息。
You can get a return value from a sub-report to the main-report using the returnValue element. The following code sets the $V{result} value in the main-report to the value of $V{total} in the sub-report. This is much more obvious in iReport instead of jrxml code.
Take a look at Subreports for more information.
您绝对可以:
只需将第一个子报表的返回值设置为主报表中所需的变量,然后在第二个子报表上传递带有前一个变量值的参数。但是,如果您将第二个子报表放置在与第一个子报表相同的详细信息区域中,然后尝试添加更多详细信息区域并将第二个子报表放置在此处,您将获得 null 值。
Absolutely you can :
Just set the return value from the first subreport to your desired variable in main report, then on your second subreport pass parameter with the value of your previous variable. But you will get null value if you placed second subreport in a same details band with the first subreport, then try to add more details band and place your second subreport here.