I have a value changed script for a tag within a UDT. I would like to reference the parameter {InstanceName} so that I can call in the name of the UDT to the script. I tried doing this with curly brackets but it didn't work. How might I do this? Thanks!
1 Like
From a valueChanged script, it should just be tag.name
.
Note the parameters that are inherent to the function:
If it's a tag that is deeply nested within the UDT, and you need the root parent's instanceName, then you can parse the name out of the tagPath:
Example:
tagPath.split('/')[1]
Edit:
It could also be parsed form the backside of the path, in case the tag nesting level varies:
Example:
tagPath.split('/')[len(tagPath.split('/'))-2]
2 Likes
I used tag['parameters']['InstanceName'] to get access to the InstanceName parameter.
4 Likes