I would like to transfer dataset from main report to subreport in iReport. In Odoo version7, I have used just like this.
<parameter name="param_obj" class="java.lang.Object" isForPrompting="false"/>
<subreport>
<reportElement x="0" y="0" width="555" height="13"/><subreportParameter name="tl_cAsset">
<subreportParameterExpression><![CDATA[$P{tl_cAsset}]]> </subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[$P{param_obj}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "acc_balance_current_assets2.jasper"]]></subreportExpression>
</subreport>
Now I using Odoo version 8 and new jasper_reports module for version 8. So I transferred some of the jar files from jasper_reports module to iReport IDE. Later... all the reports from odoo version7 caused Groovy errors. That's why I changed Groovy language to Java language in iReport. But... all the subreports didn't work because param_obj paramter didn't bring the dataset to subreport.
If I changed dataSourceExpression from param_obj to $P{REPORT_DATA_SOURCE} that built-in parameter like this:
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
, I got the error like this:
Failed to invoke method execute in class com.nantic.jasperreports.JasperServer: Field "Name-name" not found in data source.
subreport didn't get fields from the paramter datasource.
How should it be? I don't know how to pass the main dataset to subreport. If you don't mind, please explain step by step.
PS. I used XPath query language and used xml template file for that dataset.