Jump to content
Changes to the Jaspersoft community edition download ×

Parameter with default returing all values


Recommended Posts


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.
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 :)


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