# Just to be sure the difference between null and ""

**URL:** <https://forum.servoy.com/t/just-to-be-sure-the-difference-between-null-and/637>\
**Category:** Classic Servoy\
**Created:** [November 12, 2003, 6:02pm UTC](https://forum.servoy.com/t/just-to-be-sure-the-difference-between-null-and/637 "2003-11-12T18:02:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [November 12, 2003, 6:02pm UTC](https://forum.servoy.com/t/just-to-be-sure-the-difference-between-null-and/637/1 "2003-11-12T18:02:37Z")

</div>

Just to be sure I don’t do too much or too little

When I do a query and want to check it’s content for being empty can I than check that with:

dataset.getValue(1,1) == null

or do I do that with

dataset.getValue(1,1) == null || dataset.getValue(1,1) == “”

The same for a dataprovider do I do that with

dataprovidername == null

or

dataprovidername == null || dataprovidername == “”

Thanks

---

<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:** [November 12, 2003, 7:04pm UTC](https://forum.servoy.com/t/just-to-be-sure-the-difference-between-null-and/637/2 "2003-11-12T19:04:46Z")

</div>

In the method editor, javascript can handle both checks at the same time for you:

if(myField) // if myField has an entry (!= null && !=“”)  
{  
…

OR

if(!myField) //if myField doesn’t have an entry (== null || !=“”)  
{  
…

same goes for variables, arrays etc..  
BTW:  
you indeed ALWAYS have to check on both null and “”  
(if you create a new record, most of your columns will probably  
be null, untill something is entered into them)

---

<div class="post-metadata">

**Author:** ![IT2Be](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@IT2Be](https://forum.servoy.com/u/IT2Be)\
**Post date:** [November 12, 2003, 8:49pm UTC](https://forum.servoy.com/t/just-to-be-sure-the-difference-between-null-and/637/3 "2003-11-12T20:49:44Z")

</div>

Thank you maarten…
