Jump to content
We've recently updated our Privacy Statement, available here ×

Replace boolean with yes or no


ag201

Recommended Posts

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

you could use the PrintWhenExpression of that textfield.

 

I don't know, how it looks like, so it is a bit speculation...

 

so, try it like

 

$F{DBField}==true : "yes" ? "no"

 

or something similar. For that, the textfield has to be a String - field.

 

hope this helps a bit

Link to comment
Share on other sites

doesnt work for me. i am getting a bunch of errors.

 

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The method booleanValue() is undefined for the type String value = (java.lang.Boolean)(((java.lang.String)field_can_centrifuge.getValue()).booleanValue()==true ? "yes" : "no"); <----------> <----------------------------------------------------->

any ideas?

Link to comment
Share on other sites

guys let me back up ok.

 

my sql query returns a field which is a boolean in the DB. so now i create a field in my report with type string and right click on it select properties, use this as the print expression, $F{is_loggedin}.booleanValue() == true ? "Yes" : "No" for it. now when i go under view->fields, under that i have is_loggedin as string too.

 

now sometimes i am getting the error saying that booleanValue is not the right function for a string and sometimes i am getting cannot cast from string to boolean. i have done this in the past, but now am totally stuck.

 

any help guys.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...