# Shared varible in Template Repeater

**URL:** <https://forum.inductiveautomation.com/t/shared-varible-in-template-repeater/32262>\
**Category:** Ignition\
**Created:** [February 14, 2020, 11:01am UTC](https://forum.inductiveautomation.com/t/shared-varible-in-template-repeater/32262 "2020-02-14T11:01:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toobor](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@Toobor](https://forum.inductiveautomation.com/u/Toobor)\
**Post date:** [February 14, 2020, 11:01am UTC](https://forum.inductiveautomation.com/t/shared-varible-in-template-repeater/32262/1 "2020-02-14T11:01:42Z")

</div>

Hi,  
I was wondering if it is possible to have a shared varible between instances of templates when using Template Repeater?  
In my case I have created a button in a template with lable-name as input. I have then used Template Repeater to create x number of buttons. When a button is clicked I want to save the lable-name in a shared varible which I can use to know which button that was last clicked.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [February 14, 2020, 12:49pm UTC](https://forum.inductiveautomation.com/t/shared-varible-in-template-repeater/32262/2 "2020-02-14T12:49:44Z")

</div>

Create a client tag and write to that?

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [February 14, 2020, 1:20pm UTC](https://forum.inductiveautomation.com/t/shared-varible-in-template-repeater/32262/3 "2020-02-14T13:20:20Z")

</div>

You can also `.parent` up a few levels until you’re at the template repeater itself.

Just try with a number of `.parent`, and print the type of the result to see where you are.

```auto
print 1, type(event.source.parent)
print 2, type(event.source.parent.parent)
print 3, type(event.source.parent.parent.parent)
print 4, type(event.source.parent.parent.parent.parent)
print 5, type(event.source.parent.parent.parent.parent.parent)

```

---

<div class="post-metadata">

**Author:** ![Toobor](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@Toobor](https://forum.inductiveautomation.com/u/Toobor)\
**Post date:** [February 14, 2020, 2:29pm UTC](https://forum.inductiveautomation.com/t/shared-varible-in-template-repeater/32262/4 "2020-02-14T14:29:56Z")

</div>

Thank you!  
I actually tried that before but I used .name instead of type() and got ‘None’ as result.  
I see now that I did not go far enough in the hierarchy. I now get this result when using  
…parent.name:

1 Button  
2 Template\_button  
3 None  
4 None  
5 None  
6 Template Repeater  
7 Root Container

(It was the ‘None’-result that confused me.)

Thank you very much for the answer!
