# Expression Error from indirect database null before screen closes

**URL:** <https://forum.inductiveautomation.com/t/expression-error-from-indirect-database-null-before-screen-closes/22704>\
**Category:** Ignition\
**Created:** [February 20, 2019, 12:37am UTC](https://forum.inductiveautomation.com/t/expression-error-from-indirect-database-null-before-screen-closes/22704 "2019-02-20T00:37:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicklas.thystrup](https://avatars.discourse-cdn.com/v4/letter/n/ee59a6/32.png) [@nicklas.thystrup](https://forum.inductiveautomation.com/u/nicklas.thystrup)\
**Post date:** [February 20, 2019, 12:37am UTC](https://forum.inductiveautomation.com/t/expression-error-from-indirect-database-null-before-screen-closes/22704/1 "2019-02-20T00:37:44Z")

</div>

I am trying to use indirection to grab a value from a dataset.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/ed3810774fff4ec7a499760590991089c834c2fa.png)  
The binding works great when the screen is open, but throws an error when the screen closes for array out of bounds.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/dbd07fa583714858c941b980786dabd6ea1d9caa.png)  
I tried this same binding to an identical static dataset with the same data in it and it does not error. Therefore, I think this is happening due to the dataset clearing before the screen closes but the expression is trying to evaluate again. How do I prevent that from occurring?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 20, 2019, 12:56am UTC](https://forum.inductiveautomation.com/t/expression-error-from-indirect-database-null-before-screen-closes/22704/2 "2019-02-20T00:56:54Z")

</div>

If it’s just happening when you close the screen, just wrap the whole thing in the `try()` function:  
`try(toDataSet(tag)), null)`
