# global integer/number fields default "0"

**URL:** <https://forum.servoy.com/t/global-integer-number-fields-default-0/4325>\
**Category:** Classic Servoy\
**Created:** [June 8, 2005, 11:38pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325 "2005-06-08T23:38:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)\
**Post date:** [June 8, 2005, 11:38pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/1 "2005-06-08T23:38:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![maarten](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@maarten](https://forum.servoy.com/u/maarten)\
**Post date:** [June 9, 2005, 8:55am UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/2 "2005-06-09T08:55:47Z")

</div>

globals.myGlobal = null

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [June 9, 2005, 1:24pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/3 "2005-06-09T13:24:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sammyzheng](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@sammyzheng](https://forum.servoy.com/u/sammyzheng)\
**Post date:** [June 9, 2005, 4:37pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/4 "2005-06-09T16:37:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [June 9, 2005, 5:46pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/5 "2005-06-09T17:46:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gdurniak](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@gdurniak](https://forum.servoy.com/u/gdurniak)\
**Post date:** [January 14, 2007, 2:18pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/6 "2007-01-14T14:18:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jan\_Blok](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jan\_Blok](https://forum.servoy.com/u/Jan_Blok)\
**Post date:** [January 15, 2007, 12:52pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/7 "2007-01-15T12:52:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![monetteboy](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@monetteboy](https://forum.servoy.com/u/monetteboy)\
**Post date:** [October 29, 2008, 4:47pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/8 "2008-10-29T16:47:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andrei\_Costescu](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@Andrei\_Costescu](https://forum.servoy.com/u/Andrei_Costescu)\
**Post date:** [October 30, 2008, 10:17am UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/9 "2008-10-30T10:17:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![monetteboy](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@monetteboy](https://forum.servoy.com/u/monetteboy)\
**Post date:** [October 30, 2008, 2:43pm UTC](https://forum.servoy.com/t/global-integer-number-fields-default-0/4325/10 "2008-10-30T14:43:34Z")

</div>

Excellent!

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