将一个变量从一个subReport返回到Jaspersoft Ireport中的另一个subReport

Kir*_*ran 5 subreport ireport

我在jaspersoft有一个主要报告.在主报告中,我使用了两个子报告.在其中一个子报告中,我有一个可变的总现金.我必须在我的下一个子报告中使用此变量Total Cash.是否可以将变量从一个SubReport传递到另一个SubReport.如果没有,那么我如何将变量从SubReport传递到主报表.

谢谢.

use*_*279 1

您可以使用 returnValue 元素获取从子报表到主报表的返回值。以下代码将主报告中的 $V{result} 值设置为子报告中的 $V{total} 值。这在 iReport 中比 jrxml 代码中更加明显。查看子报告以获取更多信息。

<subreport isUsingCache="true">
  <reportElement x="18" y="11" width="189" height="77" key="subreport-1" />
  <connectionExpression>
    <![CDATA[$P{REPORT_CONNECTION}]]>
</connectionExpression>
  <returnValue subreportVariable="total" toVariable="result" />
  <subreportExpression class="java.lang.String">
    <![CDATA["C:/Program Files/JasperSoft/iReport-3.0.0/compile/Untitled_report_2.jasper"]]>
</subreportExpression>
</subreport>
Run Code Online (Sandbox Code Playgroud)