pyreportjasper
pyreportjasper copied to clipboard
How to implementation subreports
How to implement subreports in pyreportjasper, do I have errors when trying to process the main report?
There is more than one way to use a subreport. One of them is the way you tried, but instead of passing a *.jasper, you should pass a jrxml. Another way is by assigning only the name and extension of the subreport inside the jrxml, and the folder containing all the files that the report needs to pass as a parameter in resource.
Here is a link to an example using the last option. To continue using the current approach, use the jrxml of the subreport instead of the jasper: Example link
Example of how to use the second method mentioned
<subreport>
<reportElement x="0" y="0" width="555" height="20" uuid="e0dc40ad-4995-4e54-ae42-82a0a9a58126">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/contacts/summary")]]></dataSourceExpression>
<subreportExpression><![CDATA["header.jasper"]]></subreportExpression>
</subreport>
Here you can see why we require a jrxml in the way you are currently using.
@arnaldocorreaxO We had an error processing subreports that was fixed in version 2.1.4.