# Expressiond.binding when table result is empty

**URL:** <https://forum.inductiveautomation.com/t/expressiond-binding-when-table-result-is-empty/7964>\
**Category:** Ignition\
**Created:** [February 6, 2014, 1:06am UTC](https://forum.inductiveautomation.com/t/expressiond-binding-when-table-result-is-empty/7964 "2014-02-06T01:06:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NorthPoint](https://avatars.discourse-cdn.com/v4/letter/n/a88e4f/32.png) [@NorthPoint](https://forum.inductiveautomation.com/u/NorthPoint)\
**Post date:** [February 6, 2014, 1:06am UTC](https://forum.inductiveautomation.com/t/expressiond-binding-when-table-result-is-empty/7964/1 "2014-02-06T01:06:38Z")

</div>

I have a SQL query bringing a simple dataset into a custom property. I did it via dataset just because I wanted to use SQL to get the latest recorded value (order by XYX desc limit 1 kind of thing). From that single row dataset, I want to bind and show the values. The problem is that sometimes (often), the query returns NO rows. This is normal and expected. The issue is, I can’t get the expressions using the dataset (like x.y.z.data[“user”]) to stop faulting out on index out of range…  
Any help appreciated.

Bit of an update- I found that if I query the two fields separately I can handle the issue with fallback value. So “crisis” over…but it would be good to know if there is a way around the original issue.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [February 6, 2014, 3:03am UTC](https://forum.inductiveautomation.com/t/expressiond-binding-when-table-result-is-empty/7964/2 "2014-02-06T03:03:40Z")

</div>

Yes, there’s a couple ways. The easiest way is to use the “try” function like this:

```auto
try(x.y.z.data["user"], "")
```

If an error occurs then it is suppressed and the second value (a blank string) is returned.

Here is another way:

```auto
if(len(x.y.z.data) > 0, x.y.z.data["user"], "")
```

If the dataset has more than 0 rows then get the “user” value from the dataset otherwise get the second value (a blank string).

Best,  
Nick Mudge
