# Binding to Tag Refresh

**URL:** <https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [June 30, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399 "2022-06-30T16:37:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattEbert94](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MattEbert94](https://forum.inductiveautomation.com/u/MattEbert94)\
**Post date:** [June 30, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/1 "2022-06-30T16:37:37Z")

</div>

I’m trying to pull some data from SAP HANA to see if there is quantity available for a part. Originally, I had a named query to SAP HANA and fed it the part #, but it was very sporadic on time to query. Sometimes it would return in a second, and other times it would take upwards of 2 minutes.

So I changed my plan of action to use a query tag to pull all parts from SAP into a dataset tag and then filter on the part number for my binding. Everything works as expected until you change the part number. Since the binding is tied directly to the tag, it doesn’t refresh the binding until the tag value refreshes. I have it set to query every 2 minutes since that appeared to be my longest query time. Because of this, if I change the part #, it won’t refresh the binding until the tag refreshes within 2 minutes.

I attempted to save the dataset value from the tag to a custom property so I could pull from that, but there are over 600,000 rows and this basically bogged down Ignition and wouldn’t work.

Is there a way to bind to the current value of the tag and not wait for the refresh?

Thanks!

---

<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:** [June 30, 2022, 4:43pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/2 "2022-06-30T16:43:12Z")

</div>

Knowing nothing about SAP HANA, I would say that the place to fix this is in the database layer. Putting 600,000 rows in a dataset tag definitely seems like the wrong approach.

Again, knowing nothing about SAP HANA, can you add an index to your table on part number? Are you feeding an exact part number match, or using wildcards? 600,000 rows is _not_ that many for a modern RDBMS, and I’d expect a (properly structured) table to return an exact match _extremely_ quickly.

---

<div class="post-metadata">

**Author:** ![MattEbert94](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MattEbert94](https://forum.inductiveautomation.com/u/MattEbert94)\
**Post date:** [June 30, 2022, 4:48pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/3 "2022-06-30T16:48:08Z")

</div>

Yeah I would definitely say the error exists at the querying level of SAP HANA. Unfortunately, it’s extremely random on if the query is basically instant or takes a couple minutes to run. Right now, I’m just querying to return all parts for our specific factory so that no matter what the user enters, it will be returned in that table. Then when the text field changes on part number, I will for loop on the tag value to return the “filtered” quantity for that part, but it is never refreshed for that part # until the tag query refreshes. Is there a way to just pull whatever value the tag is currently storing and not needing to wait for the refresh?

---

<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:** [June 30, 2022, 6:23pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/4 "2022-06-30T18:23:53Z")

</div>

Is 600,000 the number of parts in your specific factory, or the overall number in the DB?

---

<div class="post-metadata">

**Author:** ![MattEbert94](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MattEbert94](https://forum.inductiveautomation.com/u/MattEbert94)\
**Post date:** [July 1, 2022, 1:40pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/5 "2022-07-01T13:40:17Z")

</div>

Just in our factory. That’s basically the only filter I can do in the query since any of the parts could possible be selected by the user.

---

<div class="post-metadata">

**Author:** ![MattEbert94](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MattEbert94](https://forum.inductiveautomation.com/u/MattEbert94)\
**Post date:** [July 1, 2022, 5:09pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/6 "2022-07-01T17:09:20Z")

</div>

Let’s say I have the tag updating every 2 mins, and I bind my property to pull quantity from the tag but instead of binding directly to the tag, I do a property binding and then add transform with a script that does a system.tag.readAsync to get the tag value. Will that pull the current value without waiting for the query to execute?

---

<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:** [July 1, 2022, 5:42pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/7 "2022-07-01T17:42:13Z")

</div>

What are you doing to pull the value out of the dataset tag? I would expect a query tag to use the last value, rather than waiting for a poll, when read by a binding or other mechanism.

---

<div class="post-metadata">

**Author:** ![MattEbert94](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MattEbert94](https://forum.inductiveautomation.com/u/MattEbert94)\
**Post date:** [July 1, 2022, 5:48pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/8 "2022-07-01T17:48:12Z")

</div>

I would’ve expected the same thing that it would use the previous value, but from the documentation [here](https://docs.inductiveautomation.com/display/DOC80/Tag+Bindings+in+Perspective) “A direct binding binds a component property to a Tag path. Every time the Tag’s value changes, the binding is evaluated and the new value is sent to the bound property.”

I tried to trigger a bindingRefresh, but it still just waits for the tag to execute the query again.

I just tried doing a readBlocking on the tag value, but it’s still waiting (or at least appears to be) for the query to execute again in the tag.

---

<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:** [July 1, 2022, 5:56pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/9 "2022-07-01T17:56:25Z")

</div>

What if you use an expression binding like `lookup({tag}, partNumber, null)`?

[https://docs.inductiveautomation.com/display/DOC81/lookup](https://docs.inductiveautomation.com/display/DOC81/lookup)

---

<div class="post-metadata">

**Author:** ![MattEbert94](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@MattEbert94](https://forum.inductiveautomation.com/u/MattEbert94)\
**Post date:** [July 1, 2022, 7:11pm UTC](https://forum.inductiveautomation.com/t/binding-to-tag-refresh/61399/10 "2022-07-01T19:11:49Z")

</div>

Didn’t realize that was an function I could use, but I’ll give it a try!

Thanks!
