# Expression to test for empty json query result

**URL:** <https://forum.inductiveautomation.com/t/expression-to-test-for-empty-json-query-result/30068>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [November 18, 2019, 8:32pm UTC](https://forum.inductiveautomation.com/t/expression-to-test-for-empty-json-query-result/30068 "2019-11-18T20:32:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [November 18, 2019, 8:32pm UTC](https://forum.inductiveautomation.com/t/expression-to-test-for-empty-json-query-result/30068/1 "2019-11-18T20:32:10Z")

</div>

Is there a simple way to test if an json query result is empty? I need an expression to bind to the display property in perspective when the data in two tables is empty.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 18, 2019, 9:09pm UTC](https://forum.inductiveautomation.com/t/expression-to-test-for-empty-json-query-result/30068/2 "2019-11-18T21:09:01Z")

</div>

There are lots of ways, but this should do what you want. I only used one table, but the logic is the same:

 ![28%20PM](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fe35110c879c53d93826a8610ad0b0ac11198cbb.png)

You could also have an individual property for each table, something like `TableOne.custom.hasData` which performs the same logic as the previous screenshot, but only for one table. Then you just bind the visibility of the tables to `{TableOne.custom.hasData} && {TableTwo.custom.hasData}`.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 18, 2019, 9:17pm UTC](https://forum.inductiveautomation.com/t/expression-to-test-for-empty-json-query-result/30068/3 "2019-11-18T21:17:50Z")

</div>

Alternatively, you could do something like

```auto
!isNull({./TableOne.props.data[0]}) && !isNull({./TableTwo.props.data[0]})

```

Or

```auto
!isNull({./Table.props.data[0]}) || !isNull({./Table.props.data[0]})

```

if you want to not display something if EITHER of them are empty.

---

<div class="post-metadata">

**Author:** ![chi](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@chi](https://forum.inductiveautomation.com/u/chi)\
**Post date:** [November 19, 2019, 8:13pm UTC](https://forum.inductiveautomation.com/t/expression-to-test-for-empty-json-query-result/30068/4 "2019-11-19T20:13:04Z")

</div>

> [@cmallonee](#):
>
> !isNull({./TableOne.props.data[0]}) && !isNull({./TableTwo.props.data[0]})

Thank you, that does exactly what i need. 😀

I tried to check the data property and did not think of testing the `data[0]` element before.
