Binding to Tag Refresh

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!

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.

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?

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

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.

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?

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.

I would’ve expected the same thing that it would use the previous value, but from the documentation here “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.

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

https://docs.inductiveautomation.com/display/DOC81/lookup

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

Thanks!