# Named Query Switch

**URL:** <https://forum.inductiveautomation.com/t/named-query-switch/39427>\
**Category:** Ignition\
**Tags:** perspective, scripting, database, ignition80\
**Created:** [October 6, 2020, 3:57pm UTC](https://forum.inductiveautomation.com/t/named-query-switch/39427 "2020-10-06T15:57:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 6, 2020, 3:57pm UTC](https://forum.inductiveautomation.com/t/named-query-switch/39427/1 "2020-10-06T15:57:17Z")

</div>

I wasn’t sure of the best title for this question, but here’s my issue…

In Vision I would have a power table and based on the result of a dropdown I would create a query string, then use this string in the SQL binding. I’m sure that’s all kinds of wrong, but that’s how I did it. With Perspective, and using named queries in general, what would be the best approach to this, short of stacking tables and using visibility?

The differences in the queries were substantial, returning different columns, different where clause, etc.

---

<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:** [October 6, 2020, 4:14pm UTC](https://forum.inductiveautomation.com/t/named-query-switch/39427/2 "2020-10-06T16:14:46Z")

</div>

You can always use a script to fire different named queries. Or, you can use the (unsafe, technically) query string parameter type and do the exact same thing that a Vision query binding could do.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [October 6, 2020, 4:32pm UTC](https://forum.inductiveautomation.com/t/named-query-switch/39427/3 "2020-10-06T16:32:30Z")

</div>

> [@paul-griffith](#):
>
> You can always use a script to fire different named queries.

You're talking about...

```auto
system.db.runNamedQuery("myUpdateQuery", params)

```

Forgot about that, thanks.
