# Expression Tag - Expression with Tags Path

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948>\
**Category:** Ignition\
**Created:** [July 5, 2023, 4:11pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948 "2023-07-05T16:11:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [July 5, 2023, 4:11pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/1 "2023-07-05T16:11:31Z")

</div>

Hello,

I have the same name expression tags in different id folders. Is it possible to extract the expression tags path for use within the expression? If possible, would mean I could copy and past the tag into a different id folder and it would work without edit.

---

<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:** [July 5, 2023, 4:21pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/2 "2023-07-05T16:21:21Z")

</div>

If the tags referenced are in the same folder as the expression, the `[.]` provider notation, possibly also with relative folder paths, should suffice. Do you have an example?

---

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [July 5, 2023, 4:47pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/3 "2023-07-05T16:47:39Z")

</div>

> [@pturmel](#):
>
> expression

Hi Phil, hard for me to provide an example without spending too much time. I guess the simpler question is, can I have an expression tag (string) within a folder who's value is the name of its parent folder?

---

<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:** [July 5, 2023, 4:52pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/4 "2023-07-05T16:52:27Z")

</div>

No. UDT instances have such. But seriously, look at the relative path options. Anything else for expression tags needs the use of the `tag()` expression function.

---

<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:** [July 5, 2023, 5:01pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/5 "2023-07-05T17:01:50Z")

</div>

Huh. This works:

```auto
objectScript("binding.expressionTagPath")

```

This yields just the containing folder:

```auto
objectScript("binding.expressionTagPath.parentPath")

```

---

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [July 5, 2023, 5:13pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/6 "2023-07-05T17:13:03Z")

</div>

Hmm... I pasted that into my expression tag's expression but it is saying 'Error\_Configuration'

---

<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:** [July 5, 2023, 5:13pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/7 "2023-07-05T17:13:47Z")

</div>

You need my Simulation Aids module installed. I would use event driven mode on that, so it only evaluates on tag startup/restart.

---

<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:** [July 10, 2023, 2:37pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/8 "2023-07-10T14:37:38Z")

</div>

Seconding the UDT idea. It's very easy to implement, just create a UDT that contains an expression tag. {PathToParentFolder} will get you the path including the UDT name, and you can use string operations to strip the last part out.

```auto
left(
	{PathToParentFolder},
	lastIndexOf({PathToParentFolder},'/')
)

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/4/54d164d9b595918473b180f5a4c5efcc1840a824.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:** [July 10, 2023, 2:42pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/9 "2023-07-10T14:42:48Z")

</div>

> [@zbinder](#):
>
> Seconding the UDT idea.

Blegh. I was trying to guide @dion.botha _away_ from creating a UDT. UDTs are pretty heavy-weight constructs. The **Right Answer™** is relative paths. UDTs are wonderful, but not for this.

---

<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:** [July 10, 2023, 2:50pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/10 "2023-07-10T14:50:28Z")

</div>

Ah, my mistake. Is the concern about memory or processing load? I've used UDTs heavily without issue, but I have to admit that it's always been for small scale applications.

---

<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:** [July 10, 2023, 2:56pm UTC](https://forum.inductiveautomation.com/t/expression-tag-expression-with-tags-path/75948/11 "2023-07-10T14:56:52Z")

</div>

> [@zbinder](#):
>
> concern about memory or processing load?

s/or/and/

and avoiding the `tag()` function (can't always, for expression tags, but should be avoided as much as possible).

and balancing original convenience against maintainability and flexibility.
