how can i compare two field values in ireport

Errors were encountered when compiling report expressions class file:
[jrc] C:\SVN_Current\csk_pos\report.temp\DailyRefundTransactionReport_1184315449517_40192.java:277: operator <= cannot be applied to java.math.BigDecimal,java.math.BigDecimal
[jrc] value = (java.lang.String)(((((java.lang.String)field_refundTransactionTenderType.getValue()).equals("HOME_OFFICE_CHECK")|| ((java.lang.String)field_refundTransactionTenderType.getValue()).equals("CHECK") || ((java.lang.String)field_refundTransactionTenderType.getValue()).equals("CURRENCY")|| ((java.lang.String)field_refundTransactionTenderType.getValue()).equals("TRAVELERS_CHECK")) && (((java.math.BigDecimal)field_refundTransactionAmount.getValue()) <= ((java.math.BigDecimal)field_refundTransactionItemAmount.getValue())))
[jrc] ^
[jrc] C:\SVN_Current\csk_pos\report.temp\DailyRefundTransactionReport_1184315449517_40192.java:285: operator > cannot be applied to java.math.BigDecimal,java.math.BigDecimal
[jrc] : (((java.lang.String)field_refundTransactionTenderType.getValue()).equals("COUPON")|| (((java.math.BigDecimal)field_refundTransactionAmount.getValue()) > ((java.math.BigDecimal)field_refundTransactionItemAmount.getValue())))
[jrc] ^
[jrc] C:\SVN_Current\csk_pos\report.temp\DailyRefundTransactionReport_1184315449517_40192.java:655: operator <= cannot be applied to java.math.BigDecimal,java.math.BigDecimal
[jrc] value = (java.lang.String)(((((java.lang.String)field_refundTransactionTenderType.getOldValue()).equals("HOME_OFFICE_CHECK")|| ((java.lang.String)field_refundTransactionTenderType.getOldValue()).equals("CHECK") || ((java.lang.String)field_refundTransactionTenderType.getOldValue()).equals("CURRENCY")|| ((java.lang.String)field_refundTransactionTenderType.getOldValue()).equals("TRAVELERS_CHECK")) && (((java.math.BigDecimal)field_refundTransactionAmount.getOldValue()) <= ((java.math.BigDecimal)field_refundTransactionItemAmount.getOldValue())))
[jrc] ^
[jrc] C:\SVN_Current\csk_pos\report.temp\DailyRefundTransactionReport_1184315449517_40192.java:663: operator > cannot be applied to java.math.BigDecimal,java.math.BigDecimal
[jrc] : (((java.lang.String)field_refundTransactionTenderType.getOldValue()).equals("COUPON")|| (((java.math.BigDecimal)field_refundTransactionAmount.getOldValue()) > ((java.math.BigDecimal)field_refundTransactionItemAmount.getOldValue())))
[jrc] ^
[jrc] C:\SVN_Current\csk_pos\report.temp\DailyRefundTransactionReport_1184315449517_40192.java:1033: operator <= cannot be applied to java.math.BigDecimal,java.math.BigDecimal
[jrc] value = (java.lang.String)(((((java.lang.String)field_refundTransactionTenderType.getValue()).equals("HOME_OFFICE_CHECK")|| ((java.lang.String)field_refundTransactionTenderType.getValue()).equals("CHECK") || ((java.lang.String)field_refundTransactionTenderType.getValue()).equals("CURRENCY")|| ((java.lang.String)field_refundTransactionTenderType.getValue()).equals("TRAVELERS_CHECK")) && (((java.math.BigDecimal)field_refundTransactionAmount.getValue()) <= ((java.math.BigDecimal)field_refundTransactionItemAmount.getValue())))
[jrc] ^
[jrc] C:\SVN_Current\csk_pos\report.temp\DailyRefundTransactionReport_1184315449517_40192.java:1041: operator > cannot be applied to java.math.BigDecimal,java.math.BigDecimal
[jrc] : (((java.lang.String)field_refundTransactionTenderType.getValue()).equals("COUPON")|| (((java.math.BigDecimal)field_refundTransactionAmount.getValue()) > ((java.math.BigDecimal)field_refundTransactionItemAmount.getValue())))
[jrc] ^
[jrc] 6 errors
manoj_pan123's picture
Joined: Jul 12 2007 - 5:36pm
Last seen: 16 years 2 months ago

1 Answer:

You should cast $F{refundTrasactionAmount} AND $F{refund_TransactionItemAmount} to an 'int' Or a 'double' before applying the .equals() method to them...

Try this:
Code:
<br />
... && $F{refund_TransactionItemAmount}.intValue()<br />
<br />
 && Integer.parseInt($F{refund_TransactionItemAmount})<br />
</td></tr></tbody></table><br />
<br />
Or something like it. Research the conversion methods used in java, that is what your problem is.
codyjasperForge's picture
Joined: Jun 6 2007 - 3:44am
Last seen: 6 years 5 months ago
Feedback