Sunday, April 26, 2020

[Java][Jasper][Resolved] Incompatible conditional types Integer and int

Source code:
<textfieldexpression class="java.lang.Integer">
    {$F{erCount}>0?$F{erCount}:-1}
</textfieldexpression>
Correction:
<textfieldexpression class="java.lang.Integer">
    {$F{erCount}.intValue()>0?$F{erCount}:new Integer(-1)}
</textfieldexpression>
Remarks:
If you don't put that -1 into Integer construtor, you would get Incompatible conditional types Integer and int again.

Referecne:
https://community.jaspersoft.com/questions/536346/incompatible-operand-types-integer-and-int 

No comments:

Post a Comment