# Fallback Value not returned when null

**URL:** <https://forum.inductiveautomation.com/t/fallback-value-not-returned-when-null/3076>\
**Category:** Ignition\
**Created:** [July 8, 2011, 8:14pm UTC](https://forum.inductiveautomation.com/t/fallback-value-not-returned-when-null/3076 "2011-07-08T20:14:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [July 8, 2011, 8:14pm UTC](https://forum.inductiveautomation.com/t/fallback-value-not-returned-when-null/3076/1 "2011-07-08T20:14:09Z")

</div>

I have a numeric textbox with a SQL query binding on the float property. I have the fallback value selected with a value of 0.

When the value in the database does not exist the query returns NULL, but Ignition gives me a red box around my component.

If I am in the designer I receive the error message:

[quote]Exception: Conversion error: query returned null, binding needs “float”  
on query binding for “SPCIR.Root Container.txtXUSL.floatValue”  
[/quote]

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/1226f32ccef8007ced6f7ebeaa122944700346f9.JPG)

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [July 8, 2011, 8:37pm UTC](https://forum.inductiveautomation.com/t/fallback-value-not-returned-when-null/3076/2 "2011-07-08T20:37:43Z")

</div>

That means your query did return a result and the result happened to be null. Change your query to the following:`SELECT COALESCE(Value, 0) FROM tbltest WHERE ID={Root Container.ddType.selectedValue}`

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [July 8, 2011, 8:49pm UTC](https://forum.inductiveautomation.com/t/fallback-value-not-returned-when-null/3076/3 "2011-07-08T20:49:55Z")

</div>

In FactoryPMI, which is where all our projects are coming from, the behavior was to use the fall back value not the resulting NULL.

Am I going to have to find everyplace we used the fall back value in place of NULLand edit the query to use ISNULL() or COALESCE()?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [July 8, 2011, 9:05pm UTC](https://forum.inductiveautomation.com/t/fallback-value-not-returned-when-null/3076/4 "2011-07-08T21:05:42Z")

</div>

The fallback value is only there if the query returns no rows on a scalar query. I am pretty sure that is how it behaved in FactoryPMI. For some reason your query is returning a single row with a null value. Run it in a query browser to see.
