views:

28

answers:

1

I want to show nothing when a numeric value is zero (strict no zeros at left)

What JasperReports format should I use so spreadsheet output like XLS gets empty cell when the value is zero 0;-0;;@ format?

A: 

One solution is to use two different PrintWhenExpressions for two field texts.

$F{columnname} == 0

and

$F{columnname} != 0

Or create a String variable (e.g., $V{b_columnname}) with the following expression:

$F{columnanme} == 0 ? '' : '' + $F{columnname}

Then remove the two static fields and replace them with a single String field:

$V{b_columnname}
Dave Jarvis
That is what I am already using but I would like to specify a format instead having to stack two field texts since it makes the reports quite unmaintainable.
Eduardo
Use a String variable with an expression that creates a blank String. You could also reuse a subreport to make the solution maintainable.
Dave Jarvis