# Default values for null tags

**URL:** <https://forum.inductiveautomation.com/t/default-values-for-null-tags/1917>\
**Category:** Ignition\
**Created:** [June 8, 2010, 11:00pm UTC](https://forum.inductiveautomation.com/t/default-values-for-null-tags/1917 "2010-06-08T23:00:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [June 8, 2010, 11:00pm UTC](https://forum.inductiveautomation.com/t/default-values-for-null-tags/1917/1 "2010-06-08T23:00:11Z")

</div>

If my externally driven tags have not been set to anything (yet) when the window opens. The value to be displayed is null. This cause java null pointer exceptions in other property bindings that expect non-null values.

Reason they have never been written to: comm failed.  
Option 1: add a bunch of wrapper code everywhere that checks for null values and replace it with non-null. - tedious, error prone, hard to maintain, and ugly  
Option 2: overlays still work. Just suppress error popup.  
Option 3: allow for default value

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [June 9, 2010, 4:38pm UTC](https://forum.inductiveautomation.com/t/default-values-for-null-tags/1917/2 "2010-06-09T16:38:53Z")

</div>

Since you’re driving the values, can you just write a default value for them in the database, perhaps also writing the quality? Or… is the quality of a db static tag always good… I can’t remember off the top of my head.

I’d guess that in general we should try to avoid generating NPEs, those are never nice and don’t really help anyone. Hence, I’d probably vote for your #2 solution.

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [June 9, 2010, 5:39pm UTC](https://forum.inductiveautomation.com/t/default-values-for-null-tags/1917/3 "2010-06-09T17:39:11Z")

</div>

For now I’m going to insert a default value (0) in the tag record when it is created.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 14, 2010, 8:50pm UTC](https://forum.inductiveautomation.com/t/default-values-for-null-tags/1917/4 "2010-06-14T20:50:02Z")

</div>

I like option #2 as well.
