# Dynamically build Tree items binding from tag path

**URL:** <https://forum.inductiveautomation.com/t/dynamically-build-tree-items-binding-from-tag-path/60869>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 16, 2022, 11:44pm UTC](https://forum.inductiveautomation.com/t/dynamically-build-tree-items-binding-from-tag-path/60869 "2022-06-16T23:44:23Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 17, 2022, 4:40pm UTC](https://forum.inductiveautomation.com/t/dynamically-build-tree-items-binding-from-tag-path/60869/6 "2022-06-17T16:40:33Z")

</div>

Something like this, perhaps?

```python
path = "Treatment/3KNG/200/100_01_Basin1_Mixer1"

parent = []
ret = parent
for part in path.split("/"):
    item = {
        "label": part,
        "expanded": True,
        "items": parent
    }
    parent.append(item)
    parent = []

return ret

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/dynamically-build-tree-items-binding-from-tag-path/60869)._
