Can anyone tell me how to compare two Big Decimal values in field expression (textFieldExpression)? I'm using iReport 3.0.0.
What is the syntax for greater then?
This is my expression, and it works but only shows if two values not equal, and I need to check which one is greater (amount > paid_amount
).
I'm using this expression:
($F{paid_date}!=null & ($F{amount}.equals($F{paid_amount}))) ? new String ("PAID") :(
($F{paid_date}==null) ? new String ("NOT PAID"): (
($F{paid_date}!=null & (!$F{amount}.equals($F{paid_amount}))) ? new String ("PARTIALLY PAID"):(new String ("INVOICE MISSING "))))
Best Answer
For fields like this:
you should use this expression:
This expression based on using int BigDecimal.compareTo(java.math.BigDecimal val) method.