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

Default value for a parameter left blank


lmbaptista

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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

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