iReport java.lang.Float hide decimals if zero
From IBM iSeries DB2 I recieve a ordered quantity DEC 11,4.
In iReport I use java.lang.Float to print the value. Also I h开发者_如何学JAVAave a pattern #,##0.0000;-#,##0.0000 (4 Decmimal places, 1000 separator).
When something is ordered in Metric Tons, this is no problem, but when something is ordered in pieces, it also prints "2,0000". This is confusing, how do I hide the ",0000"?
You can use two fields (Text Field, for example) for showing value. You can set visibility for fields (with help of "Print when expression" property) - show one field with #,##0.0000 pattern (for metric tons) and hide another with #,##0 pattern (for pieces).
Expression can check parameter or field, for example:
$F{valueUnit}.equalsIgnoreCase("metricTon")
精彩评论