Tuesday 8 August 2017

Addition of String fields in Jasper report

We have two fields :
$F{TOTAL_CHARGES_WITH_BALANCE_FORWARD}
$F{TOTAL_SERVICE_CHARGE}

which are of String type what we need to do is to cast them into Double then add both the fields and then concatenate dollar sign "$" with the value.

"$"+new Double(Double.valueOf($F{TOTAL_CHARGES_WITH_BALANCE_FORWARD}).doubleValue()+
Double.valueOf($F{TOTAL_SERVICE_CHARGE}).doubleValue())


Showing patterns; Dollar sign and brackets for negative values
$#,##0.00;($#,##0.00)