# How can I clear an integer value in a method?

**URL:** <https://forum.servoy.com/t/how-can-i-clear-an-integer-value-in-a-method/943>\
**Category:** Classic Servoy\
**Created:** [January 4, 2004, 1:24pm UTC](https://forum.servoy.com/t/how-can-i-clear-an-integer-value-in-a-method/943 "2004-01-04T13:24:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rene](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Rene](https://forum.servoy.com/u/Rene)\
**Post date:** [January 4, 2004, 1:24pm UTC](https://forum.servoy.com/t/how-can-i-clear-an-integer-value-in-a-method/943/1 "2004-01-04T13:24:10Z")

</div>

Hello,

I probably have a stupid question but I can`t clear the contents of an integer field (with Allow Null) in a method. ![:?:]( "Question")

Can anyone give me an example??

Something like.

IntegerField = 0  
IntegerField = “”  
IntegerField = null

With kind regards Rene.

---

<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:** [January 4, 2004, 2:31pm UTC](https://forum.servoy.com/t/how-can-i-clear-an-integer-value-in-a-method/943/2 "2004-01-04T14:31:34Z")

</div>

the last one should work fine (just tested it..)

numberField = null;

Doesn’t it work for you? Can you give me an example?

---

<div class="post-metadata">

**Author:** ![Rene](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Rene](https://forum.servoy.com/u/Rene)\
**Post date:** [January 4, 2004, 3:45pm UTC](https://forum.servoy.com/t/how-can-i-clear-an-integer-value-in-a-method/943/3 "2004-01-04T15:45:46Z")

</div>

Yes Now it`s working just fine.

I was clearing this value through a Relation and in some records (just about all I`ve tried) the master value was empty,

So I got an error: “Couldn`t convert an object to Null”

Meaning the relation isn`t available while I thought it was referring to the value I was resetting.

Thank you very much for replying Johan

---

<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 5, 2004, 3:47pm UTC](https://forum.servoy.com/t/how-can-i-clear-an-integer-value-in-a-method/943/4 "2004-01-05T15:47:45Z")

</div>

to check if a relation is valid use:

```auto
if (orders_to_order_details)
{
      orders_to_order_details.price = null;
}

```
