Jump to content
JasperReports Library 7.0 is now available ×

Passing a collection to subreport


Recommended Posts

By: msprasanth - msprasanth

Passing a collection to subreport

2006-02-24 09:23

hello,

I am trying to pass a javabean collection to master report which contains three attributes, name, ssn and children details(which is a collection again).

 

I wanted a report like

Name SSN

Subreport : childName, childSSN

childName, childSSN

 

I can pass a collection to the master report but from there how can i pass one of the fields of each bean (which in-turn is a collection) to the subreport ?

 

When i try this, i get a classcastexception (ArrayList)... because the child collection is an arraylist.

 

thanks for any help

 

 

 

 

By: msprasanth - msprasanth

RE: Passing a collection to subreport

2006-02-24 14:14

Well, something is wrong is iReport. When i tried with a java program (compiling and passing the Bean collection) it worked, somehow iReport needs a seperate connection to each of the report (master and sub) !!

 

Connection (not to database) but to a datasource's Static getter method that returns a collection.

 

 

 

 

By: msprasanth - msprasanth

RE: Passing a collection to subreport

2006-02-24 12:14

Ok, i got rid of ClassCastException by doing a new JRBeanCollectionDataSource($F{beanCollection})

 

but the subreport is not recognizing the beans fields in the collection.

 

It says, no getter method for field Name, but actually there is !

 

 

 

 

 

By: SiM@cK - simohack

RE: Passing a collection to subreport

2006-06-06 02:42

Thats Great, your post is gold that strains for me.

 

Thanks

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