# Getting string data from tag path dynamically

**URL:** <https://forum.inductiveautomation.com/t/getting-string-data-from-tag-path-dynamically/40209>\
**Category:** Ignition\
**Created:** [November 2, 2020, 3:07pm UTC](https://forum.inductiveautomation.com/t/getting-string-data-from-tag-path-dynamically/40209 "2020-11-02T15:07:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gracefull](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@Gracefull](https://forum.inductiveautomation.com/u/Gracefull)\
**Post date:** [November 2, 2020, 3:07pm UTC](https://forum.inductiveautomation.com/t/getting-string-data-from-tag-path-dynamically/40209/1 "2020-11-02T15:07:42Z")

</div>

I am looking to get part of my path name dynamically into a memory tag:

My path: Area/LSD/Well/tagname

If i use: left({PathToParentFolder},lastIndexOf({PathToParentFolder},"/"))  
I can get back : Area/LSD/Well/

Or If i use: left({PathToParentFolder},IndexOf({PathToParentFolder},"/"))  
I can get back : Area

But the one i need is: LSD  
i cant use a dedicated number for the index, because the Area name will change and the name length will differ. any one have any ideas how i could accomplish this?

Thank you in advance…

Edit: I am using this in an ‘Expression’ memory tag in a UDT

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [November 2, 2020, 3:19pm UTC](https://forum.inductiveautomation.com/t/getting-string-data-from-tag-path-dynamically/40209/2 "2020-11-02T15:19:58Z")

</div>

Have you thought about using split()? Something like:

```auto
split({PathToParentFolder},'/')[1,0]

```

I can’t test it right now but split returns a dataset which I believe would be one column, you want row 1 to get LSD.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [November 2, 2020, 3:25pm UTC](https://forum.inductiveautomation.com/t/getting-string-data-from-tag-path-dynamically/40209/3 "2020-11-02T15:25:41Z")

</div>

> [@bpreston](#):
>
> ```auto
> split({PathToParentFolder},'/')[1,0]
> 
> ```
> 
> I can’t test it right now but split returns a dataset which I believe would be one column, you want row 1 to get LSD.

Yes, returns one Column named parts.

If you want to only remove the Area part of the path, you can also use the split with a limit, something like

```auto
split({PathToParentFolder},'/',2)[1,0]

```

In this case, row 0 would be Area, and row 1 would be LSD/Well/tagname

---

<div class="post-metadata">

**Author:** ![Gracefull](https://avatars.discourse-cdn.com/v4/letter/g/ecb155/32.png) [@Gracefull](https://forum.inductiveautomation.com/u/Gracefull)\
**Post date:** [November 2, 2020, 3:53pm UTC](https://forum.inductiveautomation.com/t/getting-string-data-from-tag-path-dynamically/40209/4 "2020-11-02T15:53:30Z")

</div>

Thank you guys… split({PathToParentFolder},’/’)[1,0]  
Worked perfect…
