Jump to content
Changes to the Jaspersoft community edition download ×

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


jburczyk

Recommended Posts

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?  

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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"

table.png

 

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

Link to comment
Share on other sites

Why not just:

!$P{Parameter1}.isEmpty()[/code]

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

Link to comment
Share on other sites

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.

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