Using OR in the Print When Expression field


I need to print when either of two expressions is true. I've tested each expression independently, and they work. But when I put them together using ||, only the floatvalue one works. Basically, I need it to print any line that's not the ACA Fee or if the bill amount is not 0. The expression I'm trying to use is:

(!$F{pay_type}.equals("ACA Fee"))||($V{bill_amt}.floatValue() != 0.00)

I've tried adding (), and even made it the if/then statement below.

((!$F{pay_type}.equals("ACA Fee"))||($V{bill_amt}.floatValue() != 0.00)) ? Boolean.TRUE : Boolean.FALSE

If I just use !$F{pay_type}.equals("ACA Fee"), that works just fine. 

Any help would be greatly appreciated since I've never been trained on Jasper and I'm learning as I go.

amyerson's picture
Joined: Jan 28 2019 - 7:09pm
Last seen: 3 months 3 weeks ago

1 Answer:


Tried and it worked for me. The only change is that is Java, floating point shouldn't be compared using "==" because of precision.

Try the following:

!$F{pay_type}.equals("ACA Fee")) || $V{bill_amt}.floatValue() > 0.01


!$F{pay_type}.equals("ACA Fee")) || $V{bill_amt}.intValue() != 0

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 8 hours 1 min ago