Parameter with default returing all values



I'm using iReport 4.5.0 Community Edition with language set to Groovy and have trouble defining a parameter. The basic thing is that I want to build a default option 'All values' into a parameter and cannot find a way to do it.
I have a field HospitalType with values 1 (Central), 2 (Region) and 3 (Local) and some missing values. I want to have a parameter with the options Central, Region, Local and a default value All that includes all three levels. In the last case I'm asking for a range of values and that's where the problem begins. I tried using some tips I found on technical blogs and here but I'm not getting any further.
In my Report SQL query I included WHERE $X{IN, HospitalType, TypeParameter}
For my parameter TypeParameter I tried Parameter Class: java.util.List and Default Value Expression: java.util.Arrays.asList(NULL,1,2,3) but then I get an error when reading the fields in the Report query: 
Error in method invocation: Static method asList(null,int,int,int) not found in class 'java.util.Arrays'
Is this the right way to do it, where is the problem? 
Many thanks in advance for any help and suggestions.
niels.cadee's picture
Joined: Nov 9 2012 - 5:53am
Last seen: 8 years 1 month ago

1 Answer:


I wish I had more time to really spell this out but I think I can give you pointers to look in the right direction.  The parameter is of class Collection with a default value of %.

My report query has this: WHERE

$X{IN, vw_TimeTracker_Oppt.`OppType`, OpptTypeSelect}

Then on the jasperserver I make two controls, one is of type query that defines the holds your actual database query: For example there's this one that shows me all but a few that I don't want to have in a selection.  

SELECT DISTINCT opportunity_type FROM sugarcrm_prod.`opportunities` WHERE NOT ISNull(opportunity_type) AND opportunity_type NOT IN('Existing Business','New Business','Program','Series','Single') ORDER BY opportunity_type

Then you create another control where the type is something like Multi-select query (check box or radio button) then select the query control for the query resource.  On the value and visible columns I select the opportunity type from the above query.

So, I think that adds info on how to present end users with a choice as well as how to limit your return values.

I guess I did have time to explain it :)


jvway's picture
Joined: Mar 9 2009 - 11:43am
Last seen: 5 years 3 months ago

Thanks ever so much for your time Jerry! I'll try this and also the suggestion I got from Jaspersoft Support: Use Parameter Class java.util.Collection and just leave the Default Parameter Value empty. It seems to work, I'm on the right track now!

niels.cadee - 8 years 6 months ago