This function is used in Python Scripting.

Description

Asynchronously reads the value of the Tags at the given paths. Meaning, execution of the calling script will continue without waiting for this function to finish. This useful in cases where the rest of the script should continue without waiting for the results from system.tag.readAsync.

Instead of returning the tag read results to the calling script, the results are processed by a Python callback function.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.tag.readAsync(tagPaths, callback)

  • Parameters

List tagPaths - A List of Tag paths to read from. If no property is specified in the path, the Value property is assumed.

Callable callback - A Python callback function to process the read results. The function definition must provide a single argument, which will hold a List of qualified values when the callback function is invoked. The qualified values will have three sub-members: value, quality, and timestamp.

  • Returns

Nothing

  • Scope

Gateway, Vision Clients, Perspective Sessions

Code Examples
Code Snippet
# Define a function that will iterate over the results of our async read.
def checkValues(asyncReturn):
	
	# In this case we'll just create a counter, and increment it when values are over 100.
	counter = 0
	for qValue in asyncReturn:
		if qValue.value > 100:
			counter += 1
			
	# Replace this part of the function with something more useful, such as 
	# a Tag or DB write. 		
	print str(counter)

# Define the Tag paths you want to read.
paths = ["[default]Tag1", "[default]Tag2"]
			
system.tag.readAsync(paths, checkValues)
Keywords

system tag readAsync, tag.readAsync