Jump to content
Changes to the Jaspersoft community edition download ×

Set default value rather blank.


sulaiman2043

Recommended Posts

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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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