# Getting a folder name using an expression tag for a UDT

**URL:** <https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 6, 2023, 7:19pm UTC](https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663 "2023-06-06T19:19:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Berry1](https://avatars.discourse-cdn.com/v4/letter/k/76d3ee/32.png) [@Kyle\_Berry1](https://forum.inductiveautomation.com/u/Kyle_Berry1)\
**Post date:** [June 6, 2023, 7:19pm UTC](https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663/1 "2023-06-06T19:19:53Z")

</div>

Hey Everyone,

I'm having trouble writing an expression to get the folder name to write to a tag. I'm using the famous {[.]../../../..} but its only writing a value of "2" instead of the name of the folder.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/2/d29c861d6c06d68c8844db711c8fab4f00932110.png)

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [June 8, 2023, 6:40am UTC](https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663/2 "2023-06-08T06:40:17Z")

</div>

I would personally save the effort and have it set as a UDT parameter.

But I think adding

```auto
.Name

```

to the end will do this for you

---

<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:** [June 8, 2023, 12:04pm UTC](https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663/3 "2023-06-08T12:04:33Z")

</div>

Why do you need to do this? Why can you not use the `[.]../../SomeTagName` within the script where you want to perform the actual write?

---

<div class="post-metadata">

**Author:** ![zbinder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zbinder/32/28918_2.png) [@zbinder](https://forum.inductiveautomation.com/u/zbinder)\
**Post date:** [June 8, 2023, 12:50pm UTC](https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663/4 "2023-06-08T12:50:48Z")

</div>

You could start with the full tag path and use string functions to pull the part you need. If you know how many folders deep you are this will be easy. If not you should still be able to use string functions based on finding '/' characters from the right side.

EDIT: Would make more sense to start with {PathToParentFolder}. Same general approach applies.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/9530668134b416d1d449a349df04d3b8810a4fe3.png)

---

<div class="post-metadata">

**Author:** ![Kyle\_Berry1](https://avatars.discourse-cdn.com/v4/letter/k/76d3ee/32.png) [@Kyle\_Berry1](https://forum.inductiveautomation.com/u/Kyle_Berry1)\
**Post date:** [June 8, 2023, 5:16pm UTC](https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663/5 "2023-06-08T17:16:33Z")

</div>

This is for an alarm description. This tag list is auto generated from a JSON object so i just want to grab the folder name to pass into the alarm description. attached is a SS to maybe provide some clarity.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/8/488f2b6cf6d5f4ef06eafb1d561978af9564b74c.png)

---

<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:** [June 8, 2023, 5:24pm UTC](https://forum.inductiveautomation.com/t/getting-a-folder-name-using-an-expression-tag-for-a-udt/74663/6 "2023-06-08T17:24:54Z")

</div>

> [@Kyle\_Berry1](#):
>
> This tag list is auto generated from a JSON object

Then make that autogeneration operation place the tag name where you need it. Some things simply should not be done at runtime.
