Is it possible to reset a tag property to default in scripting?

I am making a platform for a client, in which tag values get displayed in certain views, based on each tag’s Function, a custom property I added. Users are able to configure each tag’s function in a designated screen.

However, when a property’s value is changed and changed back to default, it is shown as “Overrides Parent Properties”, despite being the same value as default. While testing this new functionality, I used different tags that now all show as ‘Overriden’, while the values are original.

As the title reads; Is it possible to reset the tag property to default, in scripting?

image

Have you tried writing a jython None to that property?

1 Like

I had not tried that, but I have now. It still shows the Override symbol in the tag browser, and the green circle in the tag editor.

image

image

You should be able to read the default value from the UDT definition and then write it? Otherwise, can you read the JSON to find the override, remove it, and then write it back? I haven’t done much with the JSON tag stuff but I know the override information is in there somewhere.

You may have to use system.tag.configure() to write the None.

I’m sorry, I wasn’t really giving an insight into what I was doing.

config = system.tag.getConfiguration(inputPath, True)
config[0]["_Function"] = 2
system.tag.configure(parentPath, config, 'm')

inputPath is the path to the tag containing the _Function property.

parentpath is inputPath’s parent.

Whenever you feed the output of system.tag.getConfiguration() back into system.tag.configure(), you get lots of unexpected overrides.

Construct a list of one configuration dictionary with just the tag name and the props you want to override, and then use system.tag.configure() with merge mode.