# Gateway level namedQuery?

**URL:** <https://forum.inductiveautomation.com/t/gateway-level-namedquery/42778>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [January 30, 2021, 12:12am UTC](https://forum.inductiveautomation.com/t/gateway-level-namedquery/42778 "2021-01-30T00:12:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [January 30, 2021, 12:12am UTC](https://forum.inductiveautomation.com/t/gateway-level-namedquery/42778/1 "2021-01-30T00:12:48Z")

</div>

I want to run a named query within a Tag Value Changed event script. This script will run at Gateway scope, so if I have my named query defined in my project, I have to hardcode the project name in the call to [system.db.runNamedQuery](https://docs.inductiveautomation.com/display/DOC81/system.db.runNamedQuery)

Hardcoding the project name is offensive to me, but I can’t see how to define a named query at a gateway level. Am I missing something? Or is there a different way of doing what I want to achieve? (My plan B might be to define a tag that contains the project name where the namedQuery is. Still ugly though, Plan C might be making my project the Gateway Scripting Project and putting my SQL queries into the Project Library. Is this a good idea for a project that only has tags and no visualization?)

(I want a named query because I want to call it from a large number of tags and only want to define it in the one location.)
