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

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. Possible values include: "a" Abort and throw an exception, "o" Overwrite and replace existing Tag's configuration, "i" Ignore that item in the list. Defaults to Abort. [optional]

  • 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
Code Snippet - Copy a Tag or Folder
# 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)
Keywords

system tag copy, tag.copy