Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

Friday, March 11, 2011

Negative Numbers in Jaspersoft iReport Designer

In Jaspersoft iReport Designer, you can specify the format of a numeric field like a Double (floating point number) using a Pattern.  One format is currency.  The default currency format uses U.S.-style commas and a period (the decimal point).  Negative numbers are displayed with a dash ('-').
In financial reports, you may want to display negative numbers using parenthesis.  For this format, cut-and-paste the following in the Properties of a field.

 ¤ #,##0.00;(¤ #,##0.00)

Formatting a Field with a Custom Pattern
Or, right-click on the field to bring up the Field Pattern dialog. Select "Custom Format" and paste the above string in the text field.

If you designate a field as numeric (Double, Integer, etc.) you may want to add additional formatting.  For example, the scientific notation -- which is the default -- is not used for financial statements.  Add in a currency formatting.

1 comment: