Tuesday 10 November 2015

Tip : Paranthesis Pattern for Negative BigDecimal Type fields in Jasper Reports (6.x)

Hi,
This tip is useful when exporting the report to excel with negative values.

1) Select the text field that is dragged to the designer.
   (Note that the type of this field is java.math.BigDecimal)

2) Click on it and go to the properties and apply below pattern.
    #,##0.00;(#,##0.00)

3) In above pattern the first piece is applied when the BigDecimal is non-negative and second is applied when the BigDecimal is negative. 

4) This type of pattern is useful when exporting the report to Excel. 
     i.e., Differentiate negative values surrounded by parenthesis.

NOTE : In excel export if you want to get the red color then give the pattern like below.
[Red]#,##0.00;[Red](#,##0.00)

The above pattern will display Red on the Jasper report viewer but when export the report it will give you red colored decimal with the pattern applied. 
  

http://community.jaspersoft.com/questions/525396/pattern-negative-amounts-conditional-style

No comments:

Post a Comment