Take back an override of a nested UDT instance via script?

Is there a way.
A nested instance of a UDT that was set to enabled = false by script. To set it back to the default value defined in the UDT DataType, per script. So take the override back.

I can set the attribute to enabled = True via script, but the override remains.

Manually you can remove the override by clicking on the green dot, but I could not find anything by script.

Does any of you have a solution?

Try system.tag.write("<UDT Instance>.Child.Enabled", True), if you’re currently trying to use editTag or something similar.

Hello, thanks for the solution, but that is not what I want to do.

If I do it like this then the value of the enabled attribute will be True, but it still will be overridden. I know how to change the value from True to False and back, but I need to remove the override itself.

Here is the code I use:

#search for disabled childUDT, and enable it
parentPath = "[default]Project"
udtParentType = "parentUDT"
parentList = system.tag.browseTags(parentPath=parentPath,
childList = []
for udt in parentList:
	udtParentType = "childUDT"
	childList += system.tag.browseTags( parentPath=udt.fullPath + "/someFolder",

childListAttributEnabledPaths = [udt.fullPath+".enabled" for udt in childList]
childListAttributEnabledValues = system.tag.readAll(childListAttributEnabledPaths)
childListAttributEnabledPaths2True = []
for v, p in zip(childListAttributEnabledValues,childListAttributEnabledPaths):
	if not v.value:
valueList = [True for _ in childListAttributEnabledPaths2True]
system.tag.writeAll(childListAttributEnabledPaths2True, valueList)

But like I sad this is not what I want.

In child instances of a UDT if the override exists and I change the default value in the UDT definition it will not apply to that instance, and it is not important if the override is the same as the default or not.

Here an example:
A) DataType/parentUDTDef with chidlUDT nested and the default value for attribut enabled = True
B) DataType/childUDT

  1. Project/Instance of UDTDef with childUDT override Enabled = False
  2. Project/Instance of UDTDef with childUDT override Enabled = True
  3. Project/Instance of UDTDef with childUDT and no override of the enable attribute value = default

So the 2) and 3) instances have the same value for enabled = True, the difference is the 3) instance is not overridden. If I now change the default value in A) to enabled = False
Only the Instance 3) will have this change to, and now the 1) and the 3) have the same value for attribute enabled, and because 1) and 2) have overridden values the change of the default will not have an effect on them.

My goal is to completely remove the override in 1) and 2), whether true or false and reset it to the default value.


I think this is what you are looking for.
below is a part of a script that i am using to override a nested udt and disable it, or reenable the nested instance by removing the override. I have some paramters set up that help me build the tag path to the parent UDT and the child UDT.
The important part to take away is that i am using system.tag.editTag at the parent UDT path, then overrides for the child. When removing the override, use “Enabled”:None (no quotes) instead of “true”, and the override will be removed. See the code under the else statement.

if system.tag.read(path + ".Enabled").value:

	system.tag.editTag(tagPath="[SRO_TagProv]" + Field + '/' + WellType + '/' + WellName,
	overrides={Category + "/" + Tag:{"Enabled":"false"}})

	system.tag.editTag(tagPath="[SRO_TagProv]" + Field + '/' + WellType + '/' + WellName,
	overrides={Category + "/" + Tag:{"Enabled":None}})

hopefully this helps

1 Like

thanks jlemons, that is what I need