jasper-reports

Type mismatch: cannot convert from boolean to Object value


I'm trying to put a condition in the field: Print When Expression

$F{CARTEIRA_FORMATADA}.floatValue() > $F{DESCRICOES}.floatValue() 

but it gives me an error:

Type mismatch: cannot convert from boolean to Object
value = ((java.lang.Integer)field_CARTEIRA_FORMATADA.getValue()).floatValue() > ((java.lang.Integer)field_DESCRICOES.getValue()).floatValue(); 

input values are 0 and 1, tried as Float, String (using ==), but always the same error I need to place a condition using 1 or more fields, in 'Print When Expression', and it always gives me an error converting from boolean to Object


Solution

  • I think your expression return a boolean but probably the system is looking for a Boolean(wrapper class) object.

    you can cast it to a wrapper Boolean like this.

    new Boolean($F{CARTEIRA_FORMATADA}.floatValue() > $F{DESCRICOES}.floatValue() );
    

    try this.