How to get decimal values rouded to two

In my Japer report when Im using  $F{value}.doubleValue() which results  10.0
Now the Requirement is to display 10.00.
What should I use to get 10..0 rather than 10.0 |

Thanks.

santosh.audi19's picture
Joined: Sep 9 2015 - 9:58am
Last seen: 2 years 6 days ago

3 Answers:

You can use pattern option. Go textfields properties. Under text field section you will see the pattern. 

zh3ntil's picture
3231
Joined: Nov 19 2014 - 11:02pm
Last seen: 6 years 8 months ago

what would be the proper method to insert the formatting in the expression editor.

sspecifically becuase one wants to mix both a formatted number and a formattted date in the same text field box?

Thanks

beekerc69's picture
463
Joined: Mar 6 2015 - 9:38pm
Last seen: 6 years 2 weeks ago
 
Formatting in expression editor:
 
     number format example:
     new java.text.DecimalFormat("#,###.00").format($F{price})
 
     date format example:
     new java.text.SimpleDateFormat("dd/MM/yyyy").format($F{date})
 
you can check the java expressions for others.
zh3ntil's picture
3231
Joined: Nov 19 2014 - 11:02pm
Last seen: 6 years 8 months ago
Feedback
randomness