lmbaptista Posted September 4, 2014 Share Posted September 4, 2014 Hi all, hope you can help me. I have several filters (parameters) in my report like gender, eye color, hair, etc. The user can select each characteristic or left it blank. When left blank, the report should return all records. For each filter I started to use something like: SELECT * FROM CANDIDATES where $P{GEND} = GENDER but this way the parameter can't be left blank. How can I change the script in order to allow blank filters to return all options? Thanks in advance Link to comment Share on other sites More sharing options...
hozawa Posted September 5, 2014 Share Posted September 5, 2014 Read page 105 in "Jaspersoft Studio Users Guide" about using $P! Link to comment Share on other sites More sharing options...
lmbaptista Posted September 5, 2014 Author Share Posted September 5, 2014 Thanks for your reply Hozawa. I not only checked the manual like I also search the web for some hints. Right now I created a second parameter to include a "If clause" and I have this: $P{GENDER} To select the GENDERID (since it's a test, I'm using 1 and 2) and with Prompting $P{ALLGENDER} with the default expression: $P{GENDER} == null ? "GENDERID>O":"GENDERID = " + $P{GENDER} and without prompting In the Query Editor I use: SELECT * FROM "CANDIDATES" where $P!{ALLGENDER} This works fine when I select a gender (1 or 2), but once again, if I left the parameter null I get the message "The report requires that you specify the value for some parameters before running it." Any suggestions? Thanks in advance 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