Jump to content
Changes to the Jaspersoft community edition download ×

Passing Collection to Report


2005 IR Help

Recommended Posts

By: sokie - sokhagna

Passing Collection to Report

2004-08-13 06:53

Hi,

 

I am trying to pass a collection to the report, but not successful. I am not even sure what is the parameter be in the xml file (using iReport to design it) and in the my class, would I just be something like this?

 

bytes = JasperRunManager.runReportToPdf ( reportFile.getPath(), parameters, collection);

 

Any help or suggestion is greatly appreciate?

 

 

 

 

By: Richard Barnett - richard_barnett

RE: Passing Collection to Report

2004-08-13 08:28

In this case you need to pass a JRDataSource as the 3rd parameter, so you need an implementation of this interface which treats each item in your collection as a record & maps the field names in the report definition to the appropriate methods on the collection elements.

 

Have a look at JRBeanCollectionDataSource, which uses reflection to map a field name to a property getter method.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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