sulaiman2043 Posted October 19, 2011 Share Posted October 19, 2011 I am having two issues in jasper report. 1- i am using an if condition to set a value of a text field if null found for e.g. $F{RATE}.equals(null) ? new BigDecimal(0.0000) : $F{RATE}. and when i run the report it show blank rather showing 0.0000. Is it like this to set the value or is there anyother way around to set the value. 2- when i set the textfieldExpression to set the data type it doesn't set it. when i manually define in xml then it is working fine. but after that if i move any text field or any change any element in reoprt that dataype just been removed automatically. Is it a bug in ireport or what? I am just stuck into these problems.Post Edited by sulaiman2043 at 10/19/2011 09:58 Link to comment Share on other sites More sharing options...
iamwoodyjones Posted October 19, 2011 Share Posted October 19, 2011 Are you sure you have this line correct?$F{RATE}.equals(null) ? new BigDecimal(0.0000) : $F{RATE}I'm thinking that the above statement would cause a null pointer exception if RATE is null.Typically I've always defined it as$F{RATE} == null ? new BigDecimal(0.0000) : $F{RATE}Another way which is the suggested by "Effective Java 2nd Ed." would be:$F{RATE} == null ? java.math.BigDecimal.valueOf(0.0000) : $F{RATE}---I've done that quite a bit before and had no issues. I haven't seen any issues defining data types using IReport. Seems unusual you can't define a data type there. Did you try changing focus from the data type UI element before trying to save your report?Post Edited by frankhassanabad at 10/19/2011 18:58 Link to comment Share on other sites More sharing options...
sulaiman2043 Posted October 20, 2011 Author Share Posted October 20, 2011 I have also tried with this $F{RATE} == null ? new BigDecimal(0.0000) : $F{RATE}and this $F{RATE} == null ? java.math.BigDecimal.valueOf(0.0000) : $F{RATE} but still no change...I also think there should be not an issue with this but still i am stuck into this. Link to comment Share on other sites More sharing options...
iamwoodyjones Posted October 20, 2011 Share Posted October 20, 2011 Is it possible for you to boil down the most limited .jrxml possible and attach it? 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