system.tag.copy
This function is used in Python Scripting.
Descriptionβ
Copies tags from one folder to another. Multiple Tag and folder paths may be passed to a single call of this function. The new destination can be a separate tag provider.
Copying UDTs Across Tag Providersβ
When copying UDTs to a different provider, the destination provider must have a matching UDT definition. The function copies Tags sequentially, so definitions can be placed earlier in the list, with instances following after:
# The '_types_' part of the path denotes the Data Types folder. You can retrieve the path to your UDT definition with right-click on
# on the Tag in the Tag Browser > Copy Tag Path.
udtDef = '[default]_types_/Motor'
udtInstances = '[default]UDT_Instances_Folder'
# When building the Tag list, place the definitions in list before the instances.
tags = [udtDef, udtInstances]
Tag Groupsβ
Tag Groups will not be copied to the new provider, so the copied Tags may not initially execute. This can be remedied by creating a matching Tag Group in the destination provider, either before or after the Tags have been copied.
Remote Tag Providersβ
This function can move Tags to or from a Remote Tag provider. In this case, the Tag Access Service Security settings on both providers must be set to ReadWriteEdit.
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.copy(tags, destination, [collisionPolicy])
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| List | tags | A List of tag paths to move. |
| String | destination | The destination to copy the tags to. All specified tags will be copied to the same destination. The destination tag provider must be specified. |
| String | collisionPolicy | The action to take when a tag or folder with the same path and name is encountered. Defaults to Abort. [optional]. Possible values include:
|
Returnsβ
List - A List of QualityCode objects, one for each tag in the list, that is representative of the result of the operation. See Scripting Object Reference.
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
# Define the tag/folder path(s).
tags = ['[default]Old_Tags/Subfolder' ]
# We'll move the tag/folder above to the new path.
destination = '[default]New_Tags'
# If there is a collision with the destination, we'll abort the process.
policy = 'a'
# Copy the Tags.
system.tag.copy(tags, destination, policy)