Skip to main content
Version: 7.9

system.tag.editTag

This function is used in Python Scripting.

Description

Edits an existing Tag in Ignition. This will not work on Client Tags, because there is a Client Provider for each project.

New in 7.9.8
This can now be used to edit members of a nested UDT instance.

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.editTag(tagPath, attributes, parameters, accessRights, overrides, alarmList, alarmConfig)

Parameters

TypeParameterDescription
StringtagPathThe full path to the Tag you want to edit. For members of UDT instances, the tagPath will be the path to the UDT instance, with the overrides parameter listing out the member Tags to edit.
Note: You can specify the tag provider name in square brackets at the beginning of the parentPath string. For example, [myTagProvider]MyTagsFolder. If the tag provider name is left off then the project default provider will be used.
PyDictionaryattributesThe Tag's configuration attributes.
PyDictionaryparametersThe parameters for a UDT instance Tag.
StringaccessRightsThe access rights for the Tags. Possible values are Read_Only, Read_Write, and Custom.
PyDictionaryoverridesAll of the overrides for a UDT instance Tag. The dictionary should be in the form of the names of member Tags as keys, with the values being a dictionary of properties/overrides ie. {'memberTagName':{dictionary of overrides}}.
StringalarmListList of legacy alarms for the Tag. The legacy alarm system was retired in 7.6.0. Newer systems should utilize the system.tag.editAlarmConfig function instead.
PyDictionaryalarmConfigThe alarm configuration for the Tag. Note that this parameter cannot edit alarms on UDTs. Instead, the system.tag.editAlarmConfig function (which can also edit alarms on non-UDT Tags) should be used instead. See editAlarmConfig for details on how to use this parameter.

Returns

Nothing

Scope

All

note

If called in the Gateway scope, a tag provider must be specified.

Associated Attributes

Complete list of the acceptable Tag Properties and alarmConfig.

Code Examples

Example #1 - Edit OPC Tag
# Edit OPC Tag.

system.tag.editTag(tagPath="Tag1",
attributes={"OPCServer":"Ignition OPC-UA Server", "OPCItemPath":"[MLX]N7:2"})
Example #2 - Edit UDT instance Parameters
# Edit UDT instance parameters.

system.tag.editTag(tagPath="Tag5", parameters={"DeviceName":"CLX", "MotorNumber":2})
Example #3 - Edit UDT Instance and Override Specific Properties
# Example 3: Edit UDT instance called Tag8 and override certain properties of a member Tag called STATUS.

system.tag.editTag(tagPath="Tag8", overrides={"STATUS":{"ScanClass":"Default"}})
Example #4 - Edit 2 Tags in Nested UDT Instance
# Edit 2 tags in a nested UDT instance. Assuming the following:
# - A UDT instanced named 'ParentInstance' contains a nested UDT named 'ChildInstance'
# - ChildInstance contains a Tag (member) named 'ChildMember'
# - ChildInstance contains a Tag (member) named 'Tag2' in a folder named 'Folder1'

# The following script would override multiple properties on the ChildMember tag.

path = "ParentInstance/ChildInstance"
myOverrides = {"ChildMember":{"ScanClass":"Default", "Enabled":"false"}, "Folder1/Tag2":{"ScanClass":"Default", "Enabled":"false"}}

system.tag.editTag(tagPath=path, overrides=myOverrides)
Example #5 - Edit UDT Instance and Remove Specific Properties
# Edit UDT instance called Tag8 and remove certain overrides from a member Tag called STATUS.

system.tag.editTag(tagPath="Tag8", parameters={"Param":"Something"},
overrides={"STATUS":{"ScanClass":None}})
Example #6 - Enable History, Set Historical Scan Class, and Set History Provider
# Enable history on a Tag, set the historical scan class to "Default Historical", and set the History Provider to the "Data" provider.

system.tag.editTag(tagPath="Folder/Tag",attributes={"HistoryEnabled":True, "HistoricalScanclass":"Default Historical", "PrimaryHistoryProvider":"Data"})
Example #7 - Edit a Tag Alarm with Legacy alarmList Parameter
# Edit a Tag with an Alarm using the Legacy alarmList parameter.
alert = "myAlert;Medium_High;0.0;50.0;0;;;2.0;SEC$"

system.tag.editTag(tagPath="Folder/Tag", alarmList=alert)
Example #8 - Change Tag Scan Class
# Change a new Tag's Scan Class to "<Evaluate On Change>".
# - Unlike the "Default" or "Default Historical" Scan Classes, "<Evaluate On Change>" is referenced using an empty string:

system.tag.editTag(tagPath="New Tag",attributes={"HistoricalScanclass":""})