This is unlikely, but will ask anyway.
Is there a way to force tag's property ReadOnly = False via script if this tag is ReadOnly in the first place?
This is unlikely, but will ask anyway.
Is there a way to force tag's property ReadOnly = False via script if this tag is ReadOnly in the first place?
I was able to do this in the script console by using system.tag.getConfiguration
and system.tag.configure
. These commands seem to work better with folder structures rather than individual tags, so be careful if using these with a folder containing many tags lest you reconfigure them en masse by mistake.
I created a 'ReadOnlyTest' folder with a read-only tag inside of it.
I ran the following code in read-write mode:
config = system.tag.getConfiguration("[default]Test/ReadOnlyTest", True)[0]['tags'][0]
config[u'readOnly'] = False
attempt = system.tag.configure("[default]Test/ReadOnlyTest", config, 'm')
I get a 'Good' result for my attempt
value, and the tag's configuration indeed changed from read-only mode to being writeable:
Thanks.
I modified it to below:
tagPath = <tagPath>
if readBlocking<tagPath + ".ReadOnly">:
config = system.tag.getConfiguration(tagPath, True)
config[0]['readOnly'] = False
parentPath = <parent path>
system.tag.configure(parentPath, config, 'm')
else:
#set tag to read only
tagPath = tagPath + ".ReadOnly"
system.tag.writeBlocking([tagPath], [True])
As a precaution, using system.tag.getConfiguration
on UDTInstance tags will get all of the non-default configuration of the tag which includes both the overridden properties applied to the UDT instance as well as the UDT definition's configuration. Therefore, if you use getConfiguration and configure, you will essentially apply overrides for all of its tags' configuration which is not generally what you want...
This was the reason for my request for @PGriffith to add system.tag.getLocalConfiguration to his extension module
That is disappointing.
I vote on this feature as well. Since if it is a Tag, most likely, it was generated from UDT
Luckily I am good for now, as my Tag in question was not generated from UDT.