Jump to content
JasperReports Library 7.0 is now available ×

problem passing parameters to subreport


narsis1313

Recommended Posts

Hello all,

 

I have a report with 2 subreports.

 

When i test report or subreports individually, everything is ok and 2 pages are printed.

 

But when i want to test all of them, a blank page is printed. I think because parameters are not passed from master report to subreports.

 

Is there anyone that can help me?

 

This is my code :

 

/////////////////////////\\\\\\\\\\\\

 

private void printCard(List lst) {

 

Map parameters = new HashMap();

try{

 

InputStream frontInputStream = getClass().getResourceAsStream("Sub1.xml");

InputStream backInputStream = getClass().getResourceAsStream("Sub2.xml");

InputStream frontBackInputStream = getClass().getResourceAsStream("Master_Report.xml");

 

JasperDesign frontJasperDesign = JasperManager.loadXmlDesign(frontInputStream);

JasperDesign backJasperDesign = JasperManager.loadXmlDesign(backInputStream);

JasperDesign frontBackJasperDesign = JasperManager.loadXmlDesign(frontBackInputStream);

 

JasperReport frontJasperReport = JasperManager.compileReport(frontJasperDesign);

JasperReport backJasperReport = JasperManager.compileReport(backJasperDesign);

JasperReport frontBackJasperReport = JasperManager.compileReport(frontBackJasperDesign);

parameters.put("FrontCoverReport",frontJasperReport);

parameters.put("BackCoverReport",backJasperReport);

 

JRDataSource frontBackJRDataSource = new CustomDataSource(lst);

JasperPrint frontBackJasperPrint = JasperManager.fillReport(frontBackJasperReport, parameters, frontBackJRDataSource);

JasperPrintManager.printReport(frontBackJasperPrint, false);

 

}

catch(Exception ex) {

logExceptions(ex);

}

}

 

 

////////////////////\\\\\\\\\\

 

Sincerely,

Narsis.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

There is something to be noticed :

 

My master report just containes two subreport elements.

 

I pass all of the fields to Master and pass them from master to subreports as params.

 

But i just get a blank page containing nothing.

 

Although, all of the data are passed to Master

correctly.

 

Sincerely,

 

Narsis.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...