incompatible operand issue from an expression of TextField

0

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.

bhanuchandharchalla's picture
Joined: Feb 15 2013 - 3:28am
Last seen: 6 years 8 months ago

1 Answer:

1

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

http://www.thomaszimmer.net

Thomas Zimmer's picture
Joined: Oct 2 2012 - 1:35am
Last seen: 21 hours 26 min ago

It worked for me

bhanuchandharchalla - 7 years 7 months ago
Feedback
randomness