mgurtler Posted April 25, 2013 Share Posted April 25, 2013 I have an input control 'for_user' on the JasperServer that is setup as a non-mandatory single select query. I am passing that to a parameter which I'm using in the where clause of my report query in iReport. What I'd like to do is have the parameter be the SQL wildcard '%' if the user doesn't select anything from the input control dropdown so the report will return all results. My report query looks like this:select from If the user selects something from the 'for_user' input control dropdown the report returns results, if they don't and leave it blank the report returns nothing. I have the defaul value expression of the 'for_user' parameter in iReport set as "%" but it seems to be ignoring that. Does anyone have any advice? Thanks! Link to comment Share on other sites More sharing options...
butlerc Posted April 29, 2013 Share Posted April 29, 2013 Do this, create a 2nd parameter called 'for_userToken'expression something like (you may need to tweek but you'll get the idea): P${for_user} == null ? "%" : "table.mycolumn = " + P${for_user}you may need to use P${for_user}.length() == 0 depending on your column type as opposed to == nullthen change your ireport sql to: WHERE $P!{for_userToken} note: the ! is vital Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now