# Using a parameter in the Path of a Query Binding

**URL:** <https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564>\
**Category:** Ignition\
**Tags:** database, ignition81, perspective\
**Created:** [May 17, 2024, 2:26pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564 "2024-05-17T14:26:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 17, 2024, 2:26pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/1 "2024-05-17T14:26:37Z")

</div>

Hi everyone,

I am creating an Object that has a table. I'll use this object for 20-30 different stations, so I'd like to use a parameter to tell the table which Named Query to use. See below:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/6/36e8abf96a2989bc816370823f4b36bbb1f9803c.png)  
This doesn't work, and it sure doesn't feel right. Does anyone know a good way to go about this? Using this method (if it works) id have to create Named Queries to store and retrieve data for all 20-30 stations.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 17, 2024, 2:27pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/2 "2024-05-17T14:27:54Z")

</div>

You cannot.

Consider a scripted alternative.

---

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 17, 2024, 2:31pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/3 "2024-05-17T14:31:01Z")

</div>

A scripted alternative to get data into my tables, as opposed to a query binding?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 17, 2024, 2:33pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/4 "2024-05-17T14:33:04Z")

</div>

Yes. A script can use `system.db.runNamedQuery` with a dynamic NQ name.

---

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 17, 2024, 2:40pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/5 "2024-05-17T14:40:11Z")

</div>

So In my table data binding I can create an expression that runs the named Query? Is that what you mean? Would that work?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 17, 2024, 5:15pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/6 "2024-05-17T17:15:54Z")

</div>

You **could** use `runScript()` in an expression binding, but commonly, one would use a change script on your trigger to run the NQ.

---

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 17, 2024, 5:25pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/7 "2024-05-17T17:25:53Z")

</div>

I'll give it a try, thanks @pturmel

EDIT: I am using a change script from one of my PLC tags to run the query. How do I get that data into my table? Is there a path to Table.data or do I need to move the query results into a tag first?  
This is how inductive U does it, but that's tied to a button in the same view as the table..  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/c/7c104d9e7fe53dc6dbd87494845c8d105ed0ed50.png)

---

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 17, 2024, 6:03pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/8 "2024-05-17T18:03:49Z")

</div>

Edited the above message

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 17, 2024, 6:13pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/9 "2024-05-17T18:13:08Z")

</div>

Is the tag bound to a custom property of the table? If so, then `self` is the table. Otherwise, you'll have to figure out the relative path to the table. Or, perhaps, use a `view.custom.data` and bind your table's `props.data` to that.

---

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 17, 2024, 6:16pm UTC](https://forum.inductiveautomation.com/t/using-a-parameter-in-the-path-of-a-query-binding/90564/10 "2024-05-17T18:16:07Z")

</div>

It is now, and I am adding a property change script. this should work! thanks, for the 5th time in a week, @pturmel
