Bug: system.tag.queryTagCalculations() doesn't accept relative tag path for UDT

I use the {PathToParentFolder} in the UDT's tag change script to access the full path of the UDT instance but this doesn't return the tag provider in the return path. Is this a bug?
So I wonder how can I get access full path of the UDT instance in the tag change script.

UDTs are in the same provider as instances, so it doesn't seem to be a bug.

I know that what I'm asking is about the returning the tag provider with the path.
I want to see this:
[Default]Pump1/Run
But it return this:
Pump1/Run

Not sure who I stole this from, but I use this if I need the provider in a UDT.

Below script on value change for element named TagProvider.

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	providerName = tagPath[tagPath.find("[")+1:tagPath.find("]")]
	system.tag.writeBlocking("[.]TagProvider", providerName)

Yes, I exactly do this but I believe it is too much expensive to run in a tag change script. I believe IA should provide it {PathToParentFolder}

I tested with well over 10000 instances and didn't see a noticeable difference.

Your post was how to get access, this is the only way I know of. If you want a baked in method, post here, https://ideas.inductiveautomation.com/

What I face that I need the provider is the problem in the following code which run in one of the tags in my UDT.
I try to use UDT tag wizard reference [.]tagName but it seems the system.tag.queryTagCalculations() function doesn't work with that so I have somehow get the neighbor tag path.
I really don't know what is wrong here with using "[.]Online" and why I get Null.

def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):

	# This code is not working!!!
	dataset = system.tag.queryTagCalculations(["[.]Online"], ["DurationOn"], startToday, now)
        # This code is working
	path = tagPath[0:-6] # I know my tag name is 5 chars so I get rid of it
	dataset = system.tag.queryTagCalculations([path + "/Online"], ["DurationOn"], startToday, now)

I think that is the bug.

1 Like