I got this to work using a UI Converter. It works on any kind of dataprovider - aggregations, calcs, db columns, format vars, etc. When used on db columns it does not affect the value in the db - it only affects the presentation.
Here's what I'm doing:
Create a global method called showZeroAsBlank():
- Code: Select all
function showZeroAsBlank(number) {
if (number == 0)
return null
else
return number
}
Now for each field where you want zeros to display as blanks, open the Format property dialog and do the following:
- Check 'Use a UI Converter'
- Select 'GlobalMethodConverter' from the dropdown
- Leave the first two lines in the list blank (fromObjectMethodName and type)
- Set toObjectMethodName to the showZeroAsBlank method.
- Specify a display format (e.g. #,##0.0) if you want - that will work in conjunction with the UI Converter.
- Click OK and you're done.
I've only just started using this so proceed with caution - I may yet find problems with it.
Thanks to Johan Compagner and David Workman for pointing me in the right direction.