Hi All,
I have an issue regarding Text Field expression.
1. by using SUM(Y) in database, getting integer value for SUM_Y Field in iReport. ( I have made a Field in Fields list)
2. Here I need to display Integer value coming from database in my Report By using following expression : [ $F{SUM_Y} != null ? $F{SUM_Y} : ""]
But i'm getting below the compilation error.
Incompatible conditional operand types Integer and int
value = (java.lang.Integer)(((java.lang.Integer)field_SUM_Y.getValue()) == null ? ((java.lang.Integer)field_SUM_Y.getValue()) : 0); //$JR_EXPR_ID=43$
<----------------------------------------------------------------------------------------------------->
Please help on above the issue.
Thanks in Advance.
1 Answer:
which version are you using?
however, as the expression seems to expect an "Integer", not an "int", the expression should be:
$F{SUM_Y} != null ? $F{SUM_Y} : new Integer(0)
My recommendation would be, use a substitution in your query, not in the report, like "... NVL(SUM(...), 0) as SUM_Y..."
Cheers, Thomas
It worked for me