# Script to query Persistent Data

**URL:** <https://forum.inductiveautomation.com/t/script-to-query-persistent-data/10390>\
**Category:** 3rd Party Modules\
**Created:** [August 24, 2015, 10:49pm UTC](https://forum.inductiveautomation.com/t/script-to-query-persistent-data/10390 "2015-08-24T22:49:45Z")\
**Posts on this page:** 2\
**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:** [August 24, 2015, 10:49pm UTC](https://forum.inductiveautomation.com/t/script-to-query-persistent-data/10390/1 "2015-08-24T22:49:45Z")

</div>

I am trying to write a module that will expose a script to query the internal persistent database. the problem I am having is when creating the script for the designer scope i cannot figure out how to get the the gateway context in order to query the persistent database. Can anyone give me some pointers on how to get the gateway context from inside the designer hook?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 24, 2015, 11:10pm UTC](https://forum.inductiveautomation.com/t/script-to-query-persistent-data/10390/2 "2015-08-24T23:10:09Z")

</div>

You can’t get the GatewayContext.

Instead, you have to RPC your intentions to the gateway, execute there, and then return the results.

Fortunately there is a scripting RPC example: [github.com/inductiveautomation/ … pc-example](https://github.com/inductiveautomation/ignition-sdk-examples/tree/master/scripting-rpc-example)
