Skip to main content
Version: 8.1

system.tag.readBlocking

This function is used in Python Scripting.

Description​

Reads the value of the tags at the given paths. Will "block" until the read operation is complete or times out. Meaning, execution of the calling script will pause until this function finishes. This is useful in cases where the tag read must complete before further lines in the same script should execute.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax​

system.tag.readBlocking(tagPaths, [timeout])

Parameters​

TypeParameterDescription
String or List[String]tagPathsEither a string of a single tag path, or a list of strings tag paths to read from. If no property is specified in a path, the Value property is assumed.
IntegertimeoutHow long to wait in milliseconds before the read operation times out. This parameter is optional, and defaults to 45000 milliseconds if not specified. [optional]

Returns​

List - A list of QualifiedValue objects corresponding to the tag paths. See Scripting Object Reference.

Scope​

Gateway, Vision Client, Perspective Session

Code Examples​

Example #1 - Read From Multiple Tags
# Specify the paths.
paths = ["[default]Folder/Tag_A","[default]Folder/Tag_B"]

# Send the reads off.
values = system.tag.readBlocking(paths)

# Here we can examine each value.
for i in range(len(values)):
print "Tag at Path: %s\n Had a value of %s" % (paths[i], values[i].value)
Example #2 - Read From a Single Tag
# Specify the paths.
path = ["[default]Folder/Tag_A"]

# Send the reads off.
# Function returns a list of qualified values, one qualified value for every tag path we are reading
qualifiedValues= system.tag.readBlocking(path)
value = qualifiedValues[0] # extract the qualified value from this list, there should only be 1 because we are reading a single tag value

print value.value # prints out the value of the Tag A
print value.quality # prints out the quality of Tag A
print value.timestamp # prints out the timestamp of Tag A's value