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

**URL:** <https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892>\
**Category:** Ignition\
**Created:** [March 10, 2023, 8:53am UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892 "2023-03-10T08:53:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [March 10, 2023, 8:53am UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/1 "2023-03-10T08:53:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 10, 2023, 9:18am UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/2 "2023-03-10T09:18:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [March 10, 2023, 10:43am UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/3 "2023-03-10T10:43:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [March 10, 2023, 12:50pm UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/4 "2023-03-10T12:50:01Z")

</div>

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`.

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

```

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [March 10, 2023, 2:02pm UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/5 "2023-03-10T14:02:38Z")

</div>

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}

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [March 10, 2023, 2:06pm UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/6 "2023-03-10T14:06:41Z")

</div>

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/](https://ideas.inductiveautomation.com/)

---

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [March 10, 2023, 3:18pm UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/7 "2023-03-10T15:18:14Z")

</div>

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.

```auto
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)

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 11, 2023, 11:34am UTC](https://forum.inductiveautomation.com/t/bug-system-tag-querytagcalculations-doesnt-accept-relative-tag-path-for-udt/70892/8 "2023-03-11T11:34:49Z")

</div>

> [@nader.chinichian](#):
>
> it seems the system.tag.queryTagCalculations() function doesn't work with that

I think **that** is the bug.
