# Query Binding to Transform Indirect Tag

**URL:** <https://forum.inductiveautomation.com/t/query-binding-to-transform-indirect-tag/62915>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [August 11, 2022, 1:24pm UTC](https://forum.inductiveautomation.com/t/query-binding-to-transform-indirect-tag/62915 "2022-08-11T13:24:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwilliams](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jwilliams](https://forum.inductiveautomation.com/u/jwilliams)\
**Post date:** [August 11, 2022, 1:24pm UTC](https://forum.inductiveautomation.com/t/query-binding-to-transform-indirect-tag/62915/1 "2022-08-11T13:24:13Z")

</div>

I dont know why I am having issues with this I know I have done it before but cant seem to get it to work on this project, I am confusing something simple I am sure.

I have a query binding that returns an integer, say like Job Number for example, from a database, I then have a Transform Expression to bind the returned value to a tag path, so that no matter what integer the query returns it will always find the correct tag to search it with.  
I am trying to do this:  
`{[default]Job/Job {value}}`  
where value is the retuned value from the query beforehand, but obviously this doesnt work in an expression because of the double { } braces.

---

<div class="post-metadata">

**Author:** ![jwilliams](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jwilliams](https://forum.inductiveautomation.com/u/jwilliams)\
**Post date:** [August 11, 2022, 1:33pm UTC](https://forum.inductiveautomation.com/t/query-binding-to-transform-indirect-tag/62915/2 "2022-08-11T13:33:40Z")

</div>

Figured it out I needed to use a script like so:

```auto
tag = system.tag.read("[default]Job/Job "+str(value))
	return tag

```

---

<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:** [August 11, 2022, 1:33pm UTC](https://forum.inductiveautomation.com/t/query-binding-to-transform-indirect-tag/62915/3 "2022-08-11T13:33:41Z")

</div>

Don’t do it all in one binding. Allow the query to be stored in a property. Use that property in the references of an indirect tag binding. No script required. (Transform scripts are much slower.) Also allows bidirectional on the tag.

---

<div class="post-metadata">

**Author:** ![jwilliams](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jwilliams](https://forum.inductiveautomation.com/u/jwilliams)\
**Post date:** [August 11, 2022, 1:35pm UTC](https://forum.inductiveautomation.com/t/query-binding-to-transform-indirect-tag/62915/4 "2022-08-11T13:35:28Z")

</div>

Normally that is what I would do, but I was requested to find a way to complete it in a single binding for testing purposes. We will likely use your method.
