# Ignition Dynamic Named Queries

**URL:** <https://forum.inductiveautomation.com/t/ignition-dynamic-named-queries/58312>\
**Category:** Ignition\
**Tags:** namedqueries, database, perspective\
**Created:** [April 11, 2022, 5:34pm UTC](https://forum.inductiveautomation.com/t/ignition-dynamic-named-queries/58312 "2022-04-11T17:34:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dacox1992](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dacox1992](https://forum.inductiveautomation.com/u/dacox1992)\
**Post date:** [April 11, 2022, 5:34pm UTC](https://forum.inductiveautomation.com/t/ignition-dynamic-named-queries/58312/1 "2022-04-11T17:34:16Z")

</div>

I have a few questions surrounding named queries and database connections.

When creating a named query you specify a database to run the query against. Is there a way to make dynamic named queries where the database can be a parameter passed in as a parameter similar to how it can be done with scripting?

For database connections made in the gateway, is there a way I can get connection status and also potentially read the database connection configurations to display in perspective? I’d like a user to be able to select a configured database connection from the client app so queries can be dynamic between databases.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [April 11, 2022, 5:44pm UTC](https://forum.inductiveautomation.com/t/ignition-dynamic-named-queries/58312/2 "2022-04-11T17:44:19Z")

</div>

The tags in the folder `[System]Gateway/Database` contain some information.

You can use [system.db.getConnections](https://docs.inductiveautomation.com/display/DOC81/system.db.getConnections) and [system.db.getConnectionInfo](https://docs.inductiveautomation.com/display/DOC81/system.db.getConnectionInfo) to get info about connections as well.

I don’t know about the parameterized named queries.

---

<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:** [April 11, 2022, 5:58pm UTC](https://forum.inductiveautomation.com/t/ignition-dynamic-named-queries/58312/3 "2022-04-11T17:58:58Z")

</div>

> [@dacox1992](#):
>
> Is there a way to make dynamic named queries where the database can be a parameter passed in as a parameter similar to how it can be done with scripting?

Yes:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/f/bf298c832c9c33f452346245ce1944ea7ce54429.png)

---

<div class="post-metadata">

**Author:** ![dacox1992](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dacox1992](https://forum.inductiveautomation.com/u/dacox1992)\
**Post date:** [April 11, 2022, 7:37pm UTC](https://forum.inductiveautomation.com/t/ignition-dynamic-named-queries/58312/4 "2022-04-11T19:37:15Z")

</div>

Awesome, I should have checked that out first. Thanks for the quick response!

---

<div class="post-metadata">

**Author:** ![dacox1992](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@dacox1992](https://forum.inductiveautomation.com/u/dacox1992)\
**Post date:** [April 11, 2022, 7:38pm UTC](https://forum.inductiveautomation.com/t/ignition-dynamic-named-queries/58312/5 "2022-04-11T19:38:19Z")

</div>

Thanks this is exactly what I was looking for!
