How to pass main report data source to subreport (JasperReports)?

You can pass datasource via the built-in REPORT_DATA_SOURCE parameter. The example: <subreport> <reportElement x=”261″ y=”25″ width=”200″ height=”100″/> <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + “subreport.jasper”]]></subreportExpression> </subreport> You can create new instance of datasource based on variable, parameter or field. The sample: <variable name=”HeadingsCollection” class=”java.util.Collection” calculation=”System”> <initialValueExpression><![CDATA[new java.util.ArrayList()]]></initialValueExpression> </variable> … <subreport> <reportElement x=”0″ y=”0″ width=”515″ height=”20″/> <subreportParameter name=”ReportTitle”> <subreportParameterExpression><![CDATA[$P{ReportTitle}]]></subreportParameterExpression> </subreportParameter> … Read more

How do I compile jrxml to get jasper?

There are three ways to compile jrxml to jasper. You can do direct compile via compile button (hammer logo) on iReport designer. You can use ant to compile as shown in the Ant Compile Sample. <target name=”compile1″> <mkdir dir=”./build/reports”/> <jrc srcdir=”./reports” destdir=”./build/reports” tempdir=”./build/reports” keepjava=”true” xmlvalidation=”true”> <classpath refid=”runClasspath”/> <include name=”**/*.jrxml”/> </jrc> </target> Below is the report … Read more

iReport not starting using JRE 8

There’s another way if you don’t want to have older Java versions installed you can do the following: 1) Download the iReport-5.6.0.zip from https://sourceforge.net/projects/ireport/files/iReport/iReport-5.6.0/ 2) Download jre-7u67-windows-x64.tar.gz (the one packed in a tar) from https://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html 3) Extract the iReport and in the extracted folder that contains the bin and etc folders throw in the jre. … Read more