0
我與它有一個子數據以及各個領域的報告工作:是否有可能在使用subDataSet的表組件中的主報表中引用JasperReport字段?
<subDataset name="mySubDataset">
<field name="name" class="java.lang.String"/>
<field name="net" class="java.lang.String"/>
<field name="tax" class="java.lang.String"/>
<field name="total" class="java.lang.String"/>
</subDataset>
<parameter name="myDataSource" class="net.sf.jasperreports.engine.JRDataSource" isForPrompting="false"/>
<field name="totalAmount" class="java.lang.String"/>
我遍歷「mySubDataset」使用表格組件,如下所示:
<jr:table>
<datasetRun subDataset="mySubDataset">
<dataSourceExpression><![CDATA[$P{myDataSource}]]></dataSourceExpression>
</datasetRun>
...
我會想知道的是:是否可以引用表中的「totalAmount」字段?即,我想在使用「totalAmount」字段的表的末尾添加「總計」行。例如或許通過使用columnFooter eleemnt像這樣:
<jr:column width="110">
<jr:tableHeader height="25">
<staticText>
<reportElement x="0" y="0" width="110" height="25" />
</staticText>
</jr:tableHeader>
<jr:columnHeader height="25">
<textField>
<reportElement x="0" y="0" width="110" height="25"/>
<textFieldExpression><![CDATA[$R{netCol}]]></textFieldExpression>
</textField>
</jr:columnHeader>
<jr:columnFooter height="25">
<textField>
<reportElement x="0" y="0" width="110" height="25" />
<textFieldExpression><![CDATA[$F{totalAmount}]]></textFieldExpression>
</textField>
</jr:columnFooter>
<jr:detailCell height="25">
<textField>
<reportElement x="0" y="0" width="110" height="25" />
<textFieldExpression><![CDATA[$F{net}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
我得到的是我找錯了樹和「正確」的解決方案是將總金額存放在首位的子數據的感覺,然而,我不確定這是否適合我。
更新:問題已經cross-posted in jasper forums