global integer/number fields default "0"

Hi all,

Have a easy question (hopefully) for you all. I’m using servoy R2 2.2rc6.

I have some global number/integer fields in a layout. However, the default value is “0”. Is there anyway to default it to blank? I tried putting “null”, “”, spacebar in there and non of it seems to work. Please help.

thanks in advance

sammy

globals.myGlobal = null

in the final of 2.2 you can say “null” in the default value of a global.
then it will be null instead of 0

so is my version: R2 2.2rc6 a final release?

because i put null in the default global value and it still doesn’t work.

RC means “Release Candidate” and is NOT final. Something called “Servoy 2.2” will be final.

v3.1
just wasted some time on this, until I found this post

very strange, and completely unexpected, that a global integer defaults to 0, rather than NULL

adding NULL default in the global definition does work

greg

We always try to maintain backward compatibility, that why you now have to use null to explicitly leave it uninitialized.

Is this still the case in Servoy 4?

I tried to enter “null” into the default of a global int and it wouldn’t let me save.

Thanks

Yes, this is still the case in 4.0. You can manually add " = null" in global.js.

I also changed the new/edit variable dialog to treat default value “” for NUMBER and INTEGER as null (it adds " = null" in the js file so the behavior is the expected one). This will be available in Servoy 4.1 b5.

Excellent!

Thanks so much. I had forgotten that I could just edit the variable in the global.js file.