problem in providing parameter for subreport in JasperReport

0

I have a report template that has a subreport; in main report I have some parameters that should be available in subreport too.

Main report parameter is defined like this:

<parameter class="java.lang.Integer" name="PID"></parameter>

And in subreport I defined same parameter with the same name:

<parameter class="java.lang.Integer" name="PID"></parameter>

And I provided parameters of master report for sub report like this:

<subreport>
    <reportelement height="50" width="555" x="0" y="0">
	<parametersmapexpression>
	    new HashMap($P{REPORT_PARAMETERS_MAP})
        </parametersmapexpression>
	<connectionexpression>
            <!--[CDATA[$P{REPORT_CONNECTION}]]-->
        </connectionexpression>
	<subreportexpression class="java.lang.String">
            <!--[CDATA["subRPT.jasper"]]-->
        </subreportexpression>
    </reportelement>
</subreport>

but this throws this:

SEVERE: null
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Incompatible java.lang.Integer value assigned to parameter PID in the subRPT dataset.
at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:711)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:329)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:419)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:378)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2035)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
at biorec.control.reporting$1.doInBackground(reporting.java:177)

What is the problem?

Thanks

ariyanster's picture
Joined: Oct 30 2012 - 11:03am
Last seen: 6 years 3 months ago
I think you would just do
ernestoo - 6 years 8 months ago

0 Answers:

No answers yet
Feedback