# Deriving UDT Tag Provider using a Tag Event Script

**URL:** <https://forum.inductiveautomation.com/t/deriving-udt-tag-provider-using-a-tag-event-script/36945>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [July 22, 2020, 1:52pm UTC](https://forum.inductiveautomation.com/t/deriving-udt-tag-provider-using-a-tag-event-script/36945 "2020-07-22T13:52:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![keithms](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/keithms/32/58243_2.png) [@keithms](https://forum.inductiveautomation.com/u/keithms)\
**Post date:** [July 22, 2020, 1:52pm UTC](https://forum.inductiveautomation.com/t/deriving-udt-tag-provider-using-a-tag-event-script/36945/1 "2020-07-22T13:52:15Z")

</div>

Recently I ran into a situation where I found that it would be required to have a tags provider be stored in a UDT as meta data. At first I thought to use the `{PathToParentFolder}` built in parameter however this did not work as it does not include the tags provider.

I ended up discovering that relative tag paths not only work in UDT Expressions but also UDT Scripts. Knowing this I was able to make the following Tag Event Script that writes the Tag Provider to the (string) UDT Member Tag (Memory - String) that it is bound to:

```auto
if initialChange:
	# retrieve configuration for relative tag provider
	config = system.tag.getConfiguration('[~]', False)
		
	# retrieve the actual path and set the tag value
	system.tag.writeAsync([tagPath], [config[0]['path']])

```

The `system.tag.getConfiguration()` built in function (without the recursive boolean flag set) returns a list of python dictionaries containing tag configuration information for the provided path.

In this case since we are providing only a tag provider (`[~]` is relative to the Tag provider of the Tag that is being bound) this function will always return a list containing one dictionary containing 2 keys. One of these keys is `path` which holds full path for the tag provider.
