system.tag.move
This function is used in Python Scripting.
Description​
Moves tags or folders to a new destination. The new destination can be a separate tag provider. If interested in copying the tags to a new destination, instead of moving them, please see the system.tag.copy page.
Moving Across Tag Providers​
When moving UDTs to a different provider, the destination provider must have a matching UDT definition. This function moves folders/tags sequentially, so definitions can be placed earlier in the list, with instances following after.
Note that moving tags with this function will not move or otherwise update prior Tag History or Alarm Journal entries: the old records will persist in the database at the old path, while future entries will be based on the new paths.
Remote Tag Providers​
Additionally, 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.move(tags, destination, [collisionPolicy])
Parameters​
Type | Parameter | Description |
---|---|---|
List | tags | A List of tag paths to move. |
String | destination | The destination to move the tags to. The destination tag provider must be specified: i.e., [default]Folder/myTag . |
String | collisionPolicy | The action to take when a tag or folder with the same path and name is encountered. Defaults to Overwrite. [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​
# This function moves a folder in a Tag provider to a new folder.
# Since both paths are at the same node, the "Old_Folder" will be placed at the root of the provider, and the name changed, effectively renaming the folder.
tags = ['[default]Old_Folder']
destination = '[default]New_Folder/'
# Move the folder.
system.tag.move(tags, destination)
# This function moves an entire folder of Tags to a new destination.
# Define the source and new path.
tags = ['[default]Old_Folder', '[default]Another_Folder' ]
destination = '[default]New_Folder/Imports'
# If there are any conflicts with the new destination, then abort the operation
policy = 'a'
# Move the folder
system.tag.move(tags, destination)