问题
I am new in iReport and using iReport 5.6.0 I was trying to show a text based on a condition. Suppose, I have two variables name Cr
and Dr
. And I want to show a text Net Profit
when Cr>Dr
and Net Loss
when Dr>Cr
. I was trying something like this.
($V{Dr_total}.compareTo($V{Cr_total} )? "Net Profit": "Net Loss" )
And any details tutorial about Using User Defined Expression in iReport would be very much helpful. Thanks in advance.
回答1:
It's solved. In Print When Expression I used something like this. The text is only showing when this condition is fulfilling.
$V{Dr_total}.intValue()<= $V{Cr_total}.intValue() ? Boolean.TRUE:Boolean.FALSE
来源:https://stackoverflow.com/questions/28133238/using-expressions-in-ireport