I don't want to show null values if my parameter is not empty.

0

I'm working on a report, and I have several parameters that are Multi-Select type parameters that are set up as $X{IN,column_name,parameter_name}, but in my testing when I select a value for the parameter, I'm also getting rows where column_name is null.  Is there a way to exclude those values IF the parameter is not empty?  

jburczyk's picture
Joined: Sep 20 2019 - 1:13pm
Last seen: 1 month 1 day ago

4 Answers:

0

IF I am understanding you,

If you don't have any values selected then the query returns as if null.  I was able to recreate this.

To make the element (let's say a table) not visible if the parameter is null or not set,

Set the table's advanced propertey of print when visible to only display if the parameter has value.

I was able to evaluate the expression correctly by checking if empty:

$P{Parameter1}.isEmpty().toString()=="false"

 

This effectively only displays the table element if the parameter is not empty.

danoldenkamp@gmail.com's picture
Joined: Aug 29 2018 - 11:12am
Last seen: 9 hours 12 min ago
1

Why not just:

!$P{Parameter1}.isEmpty()

the PrintWhenExpression just needs a boolean value, as isEmpty() already returns true/false there is actually no need to convert it to a String and compare the 'false' string value.

Just my two cents.

regards C-Box

C-Box's picture
2122
Joined: Jul 19 2006 - 5:58pm
Last seen: 18 hours 16 min ago
1

Thanks that's much cleaner.

danoldenkamp@gmail.com's picture
Joined: Aug 29 2018 - 11:12am
Last seen: 9 hours 12 min ago
0

Thank you both for your suggestions.  The issue that I'm having is that when I select values for the parameter, I'm getting those values in the report + the null values, and I only want those values, not the nulls.  Perhaps I just don't have my parameter set up properly.

jburczyk's picture
Joined: Sep 20 2019 - 1:13pm
Last seen: 1 month 1 day ago
Feedback