How to pass parameter to subreport using iReport 3

0

 Hi,

I have created two reports. One is master report and one is subreport. I have created 3 parameters in master report and 3 in subreport. 1 is Integer and 2 are java.util.Date.

The database query i use in master report uses integer parameter and i want to pass the same parameters to subreport to generate my main data in details section of the master report.

when i run the report i got error like:

I use ireport wizard for my subreport and map subreport parameters to the parameters of my master report.

The error i got is in code section.

Please help :).

Thanks.

Sumair.

Code:
Error filling print... net.sf.jasperreports.engine.JRException: Incompatible java.lang.Integer value assigned to parameter Block Id in the Svc Chrg dataset.
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Incompatible java.lang.Integer value assigned to parameter Block Id in the Svc Chrg dataset. 
    at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:659) 
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:327) 
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:402) 
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:361) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2013) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:749) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:252) 
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:923) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:826) 
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:59) 
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417) 
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247) 
    at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:858) 
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) 
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) 
Caused by: net.sf.jasperreports.engine.JRException: Incompatible java.lang.Integer value assigned to parameter Block Id in the Svc Chrg dataset. 
    at net.sf.jasperreports.engine.fill.JRFillDataset.setParameter(JRFillDataset.java:900) 
    at net.sf.jasperreports.engine.fill.JRFillDataset.setFillParameterValues(JRFillDataset.java:639) 
    at net.sf.jasperreports.engine.fill.JRFillDataset.setParameterValues(JRFillDataset.java:581) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1246) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:877) 
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:826) 
    at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:557) 
    at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59) 
    at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:205) 
    at java.lang.Thread.run(Thread.java:619) 
Print not filled. Try to use an EmptyDataSource...
uouser's picture
61
Joined: Jan 25 2010 - 3:18am
Last seen: 1 year 9 months ago

1 Answer:

0

Hi,

I think that the error you are getting is probably due to the mismatch of the parameter used in the subreport and the value passed from the main report . Please check for the datatype of both the passing parameter from the main report as well as the used parameter in the subreport.

 

Hope that it helps

 

Thanks,

Ankur Gupta

Ankur Gupta's picture
Joined: Jan 21 2013 - 10:36pm
Last seen: 1 year 3 months ago
Feedback