Comparing field values in iReport

expressionireportjasper-reports

I'd like to ask about comparing between field values in iReport, here is the code: $V{variable2}=($F{value1}==$F{value2})? "100":"0".

I don't know what happened but that code doesn't work as it's expected.

Please help, thanks in advance.

Best Answer

If $V{variable2} expression is

 ($F{value1}==$F{value2})? "100":"0"

And that doesnt work you may need to try to compare the primitive values or the object oriented equals() method that Alex K mentioned. Assuming the fields are integers.

($F{value1}.intValue() == $F{value2}.intValue() )? "100":"0"
Related Topic