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

How do I pass a List<int> to a subreport parameter


ericy

Recommended Posts

Hi,

My main report uses a subreport that takes in a List<int> as parameter. I want to be able to pass in a list of Integers from the main report to the subreport. The integer list is the result of a query that needs to be passed to the List<int> parameter of the subreport.

How do I do this in iReport?

Any help will be greatly appreciated.

Eric

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

->You need to define a parameter of type java.util.List  say p1

->then you have to create a variable which is of type java.lang.Boolean and its expression is

new Boolean($P{p1}.add($F{your_field_from_query})

keep the rest type as report so that all the values from the field get added into the para p1

--> now use it in your where clause as follows:

where $X{IN,col_name,p1}  

 

the only issue with this is that parameter p1 wont get initiated and wud throw null,unless u make it as a prompt and click ok when it prompts.. im not able to initiate the type list.. any help on that from anyone????

Link to comment
Share on other sites

madhukiran
Wrote:
 

->You need to define a parameter of type java.util.List  say p1

->then you have to create a variable which is of type java.lang.Boolean and its expression is

new Boolean($P{p1}.add($F{your_field_from_query})

keep the rest type as report so that all the values from the field get added into the para p1

--> now use it in your where clause as follows:

where $X{IN,col_name,p1}  

 

the only issue with this is that parameter p1 wont get initiated and wud throw null,unless u make it as a prompt and click ok when it prompts.. im not able to initiate the type list.. any help on that from anyone????

ok..for the default value of the para.. jsut give new ArrayList()

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