Jump to content

Value Convertion


swarupakp

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Thanq.Its Working..I have given in iReport Pattern as ###0.00..If it is double its working..But some times i may have String.B'coz

I m converting  field value (Inches to Cms) .So for that if i am having the in field i need to multiply with 2.54.But if the field value will be null that time its giving Null Pointer Exception..So to avoid that i can convert null to 0 then i can multiply..But we shouldnt show 0 in that place..If its null i have to show empty string over there..So if i m taking the field in String type..I can apply Blank when null..But the format is not coming i am doing like below.

(new Double(Double.parseDouble($F{Inches})*2.54).toString().

The result is String type.But i want to show in ###0.00 this format..But its not roundfig the value after the point..Its showing 111.1258 .But i want the value like 111.13.

If it is string its not converting..I knew we cannot truncate with String type values..But why the pattern is available if the data is in String type..

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