# Template repeater get selected instance

**URL:** <https://forum.inductiveautomation.com/t/template-repeater-get-selected-instance/15869>\
**Category:** Ignition\
**Created:** [November 3, 2017, 6:21pm UTC](https://forum.inductiveautomation.com/t/template-repeater-get-selected-instance/15869 "2017-11-03T18:21:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [November 3, 2017, 6:21pm UTC](https://forum.inductiveautomation.com/t/template-repeater-get-selected-instance/15869/1 "2017-11-03T18:21:04Z")

</div>

How can I get an identifying value of a selected template instance from the template repeater so I can reference that template instance in other components on my window? I would like to be able to click on a template within the template repeater and read a template parameter via scripting.

---

<div class="post-metadata">

**Author:** ![samngeru](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samngeru/32/6007_2.png) [@samngeru](https://forum.inductiveautomation.com/u/samngeru)\
**Post date:** [November 4, 2017, 3:21am UTC](https://forum.inductiveautomation.com/t/template-repeater-get-selected-instance/15869/2 "2017-11-04T03:21:18Z")

</div>

Here is something to get you started. This script is on a button in the same window as a Template Repeater. This is essentially going into the the Template Repeater from some container.

```auto
templateRepeater = event.source.parent.getComponent('Template Repeater')

templates = templateRepeater.getLoadedTemplates()

for template in templates:
	print template

```

The method below is going from a component that is in a template that is in a Template Repeater out to whichever container is housing the Template Repeater. I placed this script is on a button that is in a template that is in a Template Repeater.

```auto
templateRepeater = event.source.parent.parent.parent.parent.parent

templates = templateRepeater.getLoadedTemplates()

for template in templates:
	print template

```

There’s probably an easier way to do this but this is the method that I’ve used.

---

<div class="post-metadata">

**Author:** ![Tim](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tim/32/3361_2.png) [@Tim](https://forum.inductiveautomation.com/u/Tim)\
**Post date:** [November 9, 2017, 6:50pm UTC](https://forum.inductiveautomation.com/t/template-repeater-get-selected-instance/15869/3 "2017-11-09T18:50:31Z")

</div>

Thanks. Got something working with your method.

event.source.parent.parent.parent.parent.parent.parent.getComponent(‘Label’).text=event.source.parent.Path
