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

Why this error? [ Cannot cast boolean to Boolean ]


cioco87

Recommended Posts

Good morning,

I try to use the method PrintWhen Expression of a band , I use this expression:

 

$F{cdprov_m}=="TV"

 

 

*****

Legend of expression:

 

cdprov_m = table field, type String

"TV"= a String

 

*****

 

Why the compiler like this result --> "Cannot cast boolean to Boolean" ?

 

Please help me. More Thanks.

And please ask to my previous topic --> "Ireport Scriptlet".

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The print when expression requires a Boolean object to be generated.

 

$F{cdprov_m}=="TV"

 

generates a boolean primative.

 

To convert it to a Boolean object do the following

 

new Boolean($F{cdprov_m}=="TV")

 

In addition you need to change the syntax in your statement. You should us

 

($F{cdprov_m}.equals("TV"))

 

So your final statement should be

 

new Boolean($F{cdprov_m}.equals("TV"))

Link to comment
Share on other sites

  • 9 years later...

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...