Jump to content
We've recently updated our Privacy Statement, available here ×

Passing JrBeanCollectionDatasourse object in master and sub report


theshreyas

Recommended Posts

Hi.. i have passed the JrBeanCollectionDatasourse  from my java program to the ireport..(.jasper file)

please tell me the steps i need to do in ireport for receiving this object and displaying the values in pdf.

again i hav embedded the subreport in the summary of main report. please help me out for displaying the values in sub report also.

I have fetched the data from two tables and saved in two beans. one bean(energy_calibration) for master report and 2nd bean(shape_calibration) for subreport

please mention the steps i need to do for this in ireport. including the use of parameters

the java code i m used is:-

Code:



Post Edited by shreyas260989 at 07/12/2012 08:47



Post Edited by shreyas260989 at 07/12/2012 08:55
Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

for both main and subreport i am passing the parameters through main report.

for Subreport i have created mapping for the individual parameter.

and instead of conection i have passed JrBeanCollectionDatasourse in fillManager() method...

I hope this information may answer your question. If you  are still unclear with the information, you can ask again.. please refer the code i have  attached and the two reports master(report2) and subreport(report3) .. waiting for the help..

thanks in advance..

 

Link to comment
Share on other sites

Usual in master-detail report we have one master object (displayed in master report) and some childs of master object (displayed in subreport).

 

It is clearly seen in the discussion threads on the link in my previous answer.

Are you seen this?

 

In your case subreport displayed only after all records of main report.

This is what you wanted? Then pass Collection as parameter into main report and define DataSource expression for subreport, using this collection as parameter for method (for example createMyDataSource($P{mainReportParam}) ) which implements JRDataSource interface

 

HTH

Link to comment
Share on other sites

Hey.,, Finally I have done it..

Actually  datasourse was not going in subreport.. so i have changed the property of when no data to all sections,no data...

then i have passed the collection variable where i have fetched the subreport records..

by using   parameters.put("shape_data_all",allShape_Caliberation);

then i have created a parameter in main report.. and changed its class to java.Util.Collection..

then in subreport property, connection type=   Use a datasource expression

Data Source Expression    new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{shape_data_all})

Then added the fields in the subreport same as i am having the bean properties..

Thank you..

 

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...