Simple Ireport conditional question


I have a field that is classified as a Java.lang.String type but is being used for a true false checkbox item (weird I know)  it comes back with 1 for true(checked), 0, and null for false(unchecked)

all i would like to do is have the field display a Y or N value instead, but just using the characters Y or N does not seem to work, what else will need to be done?


what i have now:   if ( <expression> ) ==1 ? Y : N



efrizzel's picture
Joined: Apr 17 2015 - 9:50am
Last seen: 5 years 5 months ago

I'm Dumb, all it needs to be is  (<expression> ==1) ? "y" : "N"


slight formattion change, and then actually using the letters as strings, I guess thats what i get for programming late on  a Friday

efrizzel - 5 years 5 months ago

1 Answer:


You might be able to change the class that iReports casts the field as. I have only used JasperSoft Studio and that feature exists there.


when you are talking about changing the class that iReports casts the field as how did you go about doing that?  is it just selecting the field on the left hand side, and then changing it from whatever it is (java.lang.string i believe) to something else.

Yes so if you want to change the field's class you can either change the class where you defined the query by double clicking the class it automatically selects, and then you should see a ... where it will allow you to search for java classes. OR you can select the field on the left hand side and then in the field properties where it shows the class click the ... there and search. Now like I said I've only used jaspersoft studio so some of the layout options may be a little different. If you are completely stumped with how to do it in iReport however, you can pull up the source code and find the field and you will see the class it gets cast to and you can change it there but there is significantly less error checking and if something breaks it can be frustrating to get your report back to a working state. Hope this helps!!

srang's picture
Joined: Oct 28 2014 - 11:52am
Last seen: 4 years 5 months ago