nitin403 Posted May 13, 2008 Share Posted May 13, 2008 Hi all,I need to compare a string which is double value with zero.And do some conditional print of value.I tried searching and using them.But always failed in doing so.It is like this.There is a string.and I want to check that if it is greater then 0 then print one thing or else print something else.This string can be like 1234.12 also. Thanks for your help in advance. Link to comment Share on other sites More sharing options...
findashwin Posted May 13, 2008 Share Posted May 13, 2008 I dont know if I understood you correctly? Double.valueOf($F{COL_ID})>0?10:0; cant you put an expression like this? Link to comment Share on other sites More sharing options...
nitin403 Posted May 14, 2008 Author Share Posted May 14, 2008 Hi,Thanks for your reply. Here is the case.I have a field, let say $F{UnusedCreditAmount} = "1234.12"I need to display it in my report as red color when -ve and black when +veI know the code to print this field in Red. I tried many combination but it always gives error message in IReport 2.0.5 while complingBelow is the errorCode:he operator > is undefined for the argument type(s) Double, int value = (java.lang.String)(((newDouble(((java.lang.String)field_UnusedCreditAmount.getValue()))>0) Thnaks for your help in advance Link to comment Share on other sites More sharing options...
nitin403 Posted May 14, 2008 Author Share Posted May 14, 2008 hi,I found the solution.I used following code Code:(Float.parseFloat($F{UnusedCreditAmount})) < Float.parseFloat("0"«») ? "<style forecolor='#ff0000'>" + $F{UnusedCreditAmount} + "</style>" : $F{UnusedCreditAmount} 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