• Post Reply Bookmark Topic Watch Topic
  • New Topic

JasperReports printwhenexpression syntax  RSS feed

 
Michael Piaser
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm hoping somebody can lead me to a solution. this is a syntax error within Jasper reports in the printwhenexpression property.

I can use the following expression successfully: new Boolean($F{off_peak_free_minutes}.trim().equals("")==false) - this basically tells Jasper Reports to ignore the column unless it has a value.

Now I'm trying to do the same thing with ZERO but I can't get the syntax right.

I've tried: new Boolean($F{off_peak_free_minutes} != 0) but the ZERO comes up with a red underline implying that this is illegal.

I've also tried: new Boolean($F{friends_family_minutes}!=Double.valueOf(0)) but the ZERO comes up with the red underline.

I suspect I'm just not specifying the JAVA right. I believe that the $F{friends_family_minutes} variable is a DOUBLE - it prints as 0.00 on the report.
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are checking for a "0" the boolean part shouldn't be needed.

$F{off_peak_free_minutes} != 0
 
Michael Piaser
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to make it work with Jasper Reports, I had to do the following:

new Boolean(Double.valueOf($F{international_messaging_usage})!=0 && new Boolean($F{international_messaging_usage}.trim().equals("")==false))
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using == false or == true looks wrong.
Delete == false and put a bang sign (! means “not”) at the beginning of the expression.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!