Hide number when zero

Hi,
Has anyone figured out if it is possible to hide zero values??
I’m in dire need of it.

Thanks for the help

column converter? so convert 0 to null?
But that thats also in scripting suddenly a null
In 6.1 you have more options there we also have a UI Converter. so that is just for the ui itself

I can’t find documentation on how to set up a UI Converter. Can someone explain how you use these, and specifically how I would use it to convert zeros to nulls? Thanks.

Check out our fractions project on Servoy Forge: https://www.servoyforge.net/projects/fractions/wiki

Pretty clear instructions in the wiki plus the code should get you pointed in the right direction.

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():

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.

That’s good to know. Thanks Adrian, et al.