getTagValue and "Leased" scan class

Hello! At the moment i’m working on implementation of schedule in gateway script. That script has getTagValue calls, and I’m not sure how exactly this function works. Does it reffers on last value obtained by scan class inquiry, or it checks tag value on execution independently? The problem is that that tag has Leased scan class, and its slow rate time is fairly big, so I suspect that the value of inquired tag will be outdated at the time of script execution.

Using getTagValue() will return the value of the SQLTag at that given time. So if you have a tag using a leased scan class, and the tag isn’t subscribed to and visible in a client window, it will fall back to the slow rate. If you need to be sure what a PLC value is at a given time regardless of scan class for a tag, you can use system.opc.readValue().value:

inductiveautomation.com/support/ … dvalue.htm

So script will be delayed for next iteration of scan class, or value of previous inquiry will be used instantly?

No, if you use getTagValue(), it will get the tag value instantly. How quickly that tag changes values is dependent on whether the tag is subscribed to and visible in a client window (fast rate) or not (slow rate).

Ok, its all that I wanted to know, thank you.