montero Posted May 25, 2007 Share Posted May 25, 2007 Trying to print the Text Field in RED when the value is < 0, BLACK when the value =0 and GREEN when the value is >0. In the "Print when expression" to get the color GREEN font I wrote: Code:$F{PCT_TRUE_DIFF}.comparTo(new BigDecimal(0)) >0 In another field2 i have Code:[code]$F{PCT_TRUE_DIFF}.comparTo(new BigDecimal(0)) <0 to get the color RED font and in field3 i have Code:[code]$F{PCT_TRUE_DIFF}.comparTo(new BigDecimal(0)) =0 to get the color BLACKfont None of this is working as i get a "Cannot cast from boolean to boolean" error. The fields are all BigDecimals btw. And i have 3 of them all on top of one another in the report detail band. Any advice would be greatly appreciated as i haven't have the slightest clue as to why i would be getting this type of error. Post edited by: rubedogg04, at: 2007/05/24 22:08 Post edited by: rubedogg04, at: 2007/05/24 22:09 Post edited by: rubedogg04, at: 2007/05/24 22:10Post edited by: rubedogg04, at: 2007/05/24 22:11 Link to comment Share on other sites More sharing options...
svenn Posted May 25, 2007 Share Posted May 25, 2007 Is the error "Cannot cast from boolean to boolean" or is it "Cannot cast from boolean to Boolean" I'm thinking that your logic is generating a boolean when you want it to be generating a Boolean. If so try incasing your expression with new Boolean( <your expression> )Post edited by: svenn, at: 2007/05/25 15:48 Link to comment Share on other sites More sharing options...
montero Posted May 25, 2007 Author Share Posted May 25, 2007 That worked! Thank you very much svenn! I placed a new Boolean in front of my expression and that worked. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now