system.tag.writeAsync
This function is used in Python Scripting.
Description​
Asynchronously writes values to tags at specified paths. The script will not wait for the write operation to complete before moving on, but you can provide a callback function to run further code after the write has finished.
For a blocking tag write operation, see system.tag.writeBlocking.
Client Permission Restrictions​
Permission Type: Tag Editing
Client access to this scripting function is blocked to users that do not meet the role/zone requirements for the above permission type. This function is unaffected when run in the Gateway scope.
Syntax​
system.tag.writeAsync(tagPaths, values, [callback])
Parameters​
Type | Parameter | Description |
---|---|---|
List | tagPaths | A List of tag paths to write to. A tag property can be included in the path. If no property is specified in a tag path, the Value property is assumed. |
List | values | The values to write to the specified paths. |
Callable | callback | A function that will be invoked after the write operation is complete. The function must take a single argument: a List of QualityCode objects corresponding to the results of the write operation. [optional] |
Returns​
Nothing
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Example #1 - Write to Multiple Tags
paths = ["[default]Tag1", "[default]Folder/Tag2"]
values = [10, 10]
system.tag.writeAsync(paths, values)
Example #2 - Using a Callback Function
paths = ["[default]Tag1", "[default]Folder/Tag2"]
values = [10, 10]
def myCallback(asyncReturn):
for result in asyncReturn:
# Do something if a bad qualified value was returned
if not result.good:
print result
system.tag.writeAsync(paths, values, myCallback)