system.tag.writeAll
This function is used in Python Scripting.
Description
Performs an asynchronous bulk write. Takes two sequences that must have the same number of entries. The first is the list of tag paths to write to, and then second is a list of values to write. This function is dramatically more efficient than calling write multiple times.
Client Permission Restrictions
This scripting function has no Client Permission restrictions.
Syntax
system.tag.writeAll(tagPaths, values)
- Parameters
- String[]
tagPaths
- The paths of the tags to write to. - Object[]
values
- The values to write.
- String[]
- Returns
- int[] - Array of ints with an element for each tag written to: 0 if the write failed immediately, 1 if it succeeded immediately, and 2 if it is pending.
- Scope
- All
Code Examples
Example #1
# This code write to 5 tags at once.
tags = ["Tags/T1", "Tags/T2", "Tags/T3", "Tags/T4", "Tags/T5"]
values = [2, 4, 8, 16, 32]
values = system.tag.writeAll(tags,values)
Example #2
# Similar to the prior example, except this includes the tag provider in the tag path of each tag.
tags = ["[tagProvider]Tags/T1", "[tagProvider]Tags/T2", "[tagProvider]Tags/T3", "[tagProvider]Tags/T4", "[tagProvider]Tags/T5"]
values = [2, 4, 8, 16, 32]
values = system.tag.writeAll(tags,values)