Hi, I'm trying to create a report where I get an Integer describing the role of a family member.
I'm trying to print it using the following expression:
($F{Role}.intValue() == 1) ?"Father":"Mother"
but I get always the following error message when I try to run the report:
Cannot Cast from String to Integer
What can be done? I've tried of lot of things but nothing seems to work.
I'm trying to print it using the following expression:
($F{Role}.intValue() == 1) ?"Father":"Mother"
but I get always the following error message when I try to run the report:
Cannot Cast from String to Integer
What can be done? I've tried of lot of things but nothing seems to work.
3 Answers:
Posted on July 9, 2008 at 1:35pm
The type of $F{Role} needs to remain in Integer. Keep the exact expression you have, but change the type of the expression to String. If you are working in iReport and you created this textfield by dragging it into the report design, iReport will create a textfield with the fields type by default. But your expression returns a string so you need to update the textfield type to reflect this.
Hope this helps.
Hope this helps.