# Getting A Value From A Template In A Template Repeater

**URL:** <https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128>\
**Category:** Ignition\
**Created:** [June 15, 2015, 1:20pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128 "2015-06-15T13:20:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rayjones9210](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@rayjones9210](https://forum.inductiveautomation.com/u/rayjones9210)\
**Post date:** [June 15, 2015, 1:20pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/1 "2015-06-15T13:20:57Z")

</div>

How do I get a value from a specific numeric text field component that’s inside of a template repeater? I’d like to take that value and store it in a database through scripting.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [June 15, 2015, 4:49pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/2 "2015-06-15T16:49:06Z")

</div>

`templates = event.source.parent.getComponent('Template Repeater').getLoadedTemplates()
for template in templates:
	print "Value: ", template.getPropertyValue("TextValue")`

Where TextValue is a template parameter or internal property of the template.

---

<div class="post-metadata">

**Author:** ![rdeavers](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@rdeavers](https://forum.inductiveautomation.com/u/rdeavers)\
**Post date:** [September 8, 2015, 10:55pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/3 "2015-09-08T22:55:34Z")

</div>

I tried this out and got the following error

[quote]AttributeError: ‘[com.inductiveautomation.factorypmi.application.com](http://com.inductiveautomation.factorypmi.application.com)’ object has no attribute ‘getLoadedTemplates’  
[/quote]  
I even tried getTemplates() and got the same error. Also looking at the documentation, under Scripting Functions, it says This component has no special scripting functions. How are we able to get data from the repeater?  
I am using Ignition 7.7.1

---

<div class="post-metadata">

**Author:** ![ian](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@ian](https://forum.inductiveautomation.com/u/ian)\
**Post date:** [September 9, 2015, 3:28am UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/4 "2015-09-09T03:28:39Z")

</div>

Hi rdeavers,

I tried this:

`templateRepeater = event.source.parent.getComponent('Template Repeater')
print templateRepeater
templates = templateRepeater.getLoadedTemplates()
for template in templates:
   print "Value: ", template.getPropertyValue("tankLevel")`

And I got this:

`com.inductiveautomation.factorypmi.application.components.TemplateRepeater[Template Repeater,96,45,587x544,layout=com.inductiveautomation.ignition.client.util.gui.FillingLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]
Value: 27
Value: 27
Value: 27
Value: 27`

Perhaps, you can also print what component you get to ensure that it is really a template repeater

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

The attribute error:

```auto
AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'getLoadedTemplates'
```

could be caused because the object isn’t really a template repeater.

I use Ignition 7.7.4

---

<div class="post-metadata">

**Author:** ![ian](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@ian](https://forum.inductiveautomation.com/u/ian)\
**Post date:** [September 9, 2015, 3:30am UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/5 "2015-09-09T03:30:35Z")

</div>

My apologize,

these two should be quotes instead of code

[quote]com.inductiveautomation.factorypmi.application.components.TemplateRepeater[Template Repeater,96,45,587x544,layout=com.inductiveautomation.ignition.client.util.gui.FillingLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=]  
Value: 27  
Value: 27  
Value: 27  
Value: 27[/quote]

> [@](#):
>
> AttributeError: '[com.inductiveautomation.factorypmi.application.com](http://com.inductiveautomation.factorypmi.application.com)' object has no attribute 'getLoadedTemplates'

Sorry for the confusion...

---

<div class="post-metadata">

**Author:** ![ian](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@ian](https://forum.inductiveautomation.com/u/ian)\
**Post date:** [September 9, 2015, 4:05am UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/6 "2015-09-09T04:05:28Z")

</div>

Hi rayjones9210,

If what you meant is to get a property value of a component in a template within a template repeater, then you can further get the component from the template after you obtain your template from a template receiver.

Something like this:

`templateRepeater = event.source.parent.getComponent('Template Repeater') #get the template repeater
templates = templateRepeater.getLoadedTemplates() #get all templates in template repeater
template = templates[0] #note that [0] refers to the first template in the templateRepeater
label = template.getComponent('Label') #get the component in the template
print label.text #get a property value of a component`

---

<div class="post-metadata">

**Author:** ![rdeavers](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@rdeavers](https://forum.inductiveautomation.com/u/rdeavers)\
**Post date:** [September 9, 2015, 3:52pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/7 "2015-09-09T15:52:02Z")

</div>

It worked after I upgraded to 7.7.5. This function does not work in 7.7.1.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![ian](https://avatars.discourse-cdn.com/v4/letter/i/bb73d2/32.png) [@ian](https://forum.inductiveautomation.com/u/ian)\
**Post date:** [September 10, 2015, 1:43am UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-template-in-a-template-repeater/10128/8 "2015-09-10T01:43:02Z")

</div>

Hi rdeavers,

Glad to hear that! So, it is really the version, not the component type… 🙂
