Jump to content

Chart Legend displays null values


gr4nt4

Recommended Posts

I have an SQL that returns null values but the chart fails to compile due to a 'nul pointer Exception' so I've used the code

$F{PRODUCTDESC}==null?"":$F{PRODUCTDESC}

However this now produces an legend segment that has no description in (see graphic)

I'm looking to do one of the below:

1. Remove the single segment from the legend

2.Change the segment color to white and the segment border to white

3. Have the chart compile correctly even with a nul value.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

If you don't want rows with a NULL product description to show up in the report, then the usual choice is to modify the SQL query so that it does not return them. Is that an option in your case?

 

Either like this:
where PRODUCTDESC is not null

 

Or like this:
coalesce(PRODUCTDESC,'No Desc')

 

Regards,
Matt

Link to comment
Share on other sites

Do you want the nulls in the chart but with a different label, or do you want them filtered out? If you want to filter them out completely but can't do it in the query, use the filterExpression to skip rows that are null. The expression can be "new Boolean($F{field} == null)". In iReport there is a button on the query screen that lets you set the filter.
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...