Skip to main content
Version: 8.1

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​

TypeParameterDescription
ListtagsA List of tag paths to move.
StringdestinationThe destination to copy the tags to. All specified tags will be copied to the same destination. The destination tag provider must be specified.
StringcollisionPolicyThe action to take when a tag or folder with the same path and name is encountered. Defaults to Abort. [optional]. Possible values include:
  • a - Abort and throw an exception
  • o - Overwrite and replace existing tag's configuration
  • i - Ignore that item in the list.

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​

Example #1 - 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