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

How to pass a collection to the sub report for using as a parameter.


kavita.negi

Recommended Posts

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

I have a query that returns the name of employees

select emp_name from employee ,it returns 5 names and the type automatically of emp_name is string. While Showing in main report ,the whole report iterate for each record.

 

I want to know that is there any way to pass these employee names as a collection to subreport .I am trying too much bu could not find any solution it.

Tell me whether it is possible or not .Or we have to use some other datasource to create it .

Link to comment
Share on other sites

Hi,

well you could either pass the report connection to the subreport and (re)call the data from datasource with the same query again (if it's needed at each employee level from MasterReport again)..... or you could also collect all your employee  names into a variable (e.g. via add($F{name}) method for ArrayList<String>) and pass this variable to a subreport via parameter at the end of the master-report (e.g, summary band or a dummy groupfooter band). There you could evaluate the parameter again and design your SubReport as needed.

 

There's more than one way to skin a cat. http://community.jaspersoft.com/sites/all/libraries/ckeditor/plugins/smiley/images/wink_smile.gif

thth + regards from Germany

C-Box

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