# Group, Container or Template Repeater?

**URL:** <https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [January 10, 2025, 6:55pm UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745 "2025-01-10T18:55:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [January 10, 2025, 6:55pm UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/1 "2025-01-10T18:55:00Z")

</div>

What would make the most sense of the three?

I have three templates per grouping and will have 19 of these groupings. Each grouping has a button to toggle a button state within each template, and each template's button can toggle it's own button state.

I found that with `Containers` I cannot move them like other components, so positioning would be more technical. Other than that, are there any recommendations regarding which `Container Type` I should use?

**Note** : only the Grouped objects are tied to tag values and I have little extra styling.

Group:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/e/4e1b5f86b0a3e2d3faa07ee3c70fed08050bc7a6.png)

Container:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/0/f0f7b493e277ddf9f2e705348c32446769c818a6.png)

Template Repeater:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/1/319ef2a2814ff688b77256aba74f52ae4e066187.png)

---

<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:** [January 10, 2025, 7:03pm UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/2 "2025-01-10T19:03:53Z")

</div>

If you've got 19 identical groups (of 1 button + 3 templates) I'd absolutely package that into a template and use a Template Repeater or Template Canvas to render the 19 instances, no question.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [January 14, 2025, 1:05am UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/3 "2025-01-14T01:05:27Z")

</div>

I'm playing with something like this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/6/36529c71c879d7cdd9fdad420d7c890ada1135b3.png)

Parent: Template Repeater.  
Each group of three plus the big button is in a Template.  
Group of three without the big button are Templates in a Template Repeater.

So, to "navigate" to the individual template: Repeater --\> Template--\> Repeater --\> Template.

Each individual template is an UDT. Is this nesting too much to realistically pass parameters/values to the UDT and retrieve changes made? It seems like a quick way to instantiate a bunch of templates.

Could I do something like this:

```python
repeater = event.source..parent.getComponent('Template Repeater')
for template in repeater.loadedTemplates:
     repeater2 = template.getComponent('Template Repeater 2')
          for template2 in repeater2:
               do something here?

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 14, 2025, 2:47am UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/4 "2025-01-14T02:47:17Z")

</div>

Since the inner repeater is always three, I'd probably just use three instances.

But anyway, Vision doesn't have any significant problem with complex nesting, and there are no barriers to traversing the hierarchy by script any way you need, so carry on.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [January 14, 2025, 6:13pm UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/5 "2025-01-14T18:13:10Z")

</div>

Well, I'm going to have at least 19 instances, 16 of one template, 3 of another.

I couldn't figure out how to go that deep in the example above, so I built another.

This time: Repeater with a dataset, and each instance is a Template of 3 templates.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/0/e08eba49af5d7609bec71936018982698f47ef33.png)  
Each grouping, including the large button is a template, the internal templates/ **UDTs** are the three "line items".  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/7/b7abfb0e66aceae8f4faa720fddeede59a677566.png)

I'm having a hard time wrapping my head around getting to the nested templates/repeaters (in the first post).

```python
repeater = event.source.parent.getComponent('Template Repeater 2')
for template in repeater.loadedTemplates:
	template2 = template.getComponent('Zone_3Pos')
	template2.templateParams['toggle_main'] = 1

```

The _above_ code presents the error: `Nonetype has no attribute: templateParams`, which refers to `template2` variable.

```python
repeater = event.source.parent.getComponent('Template Repeater 2')
for template in repeater.loadedTemplates:
	arguments = []
	for customProp in template.dynamicProps:
		arguments.append(template.getPropertyValue(customProp))
	print(arguments)

```

**EDIT:**  
~~This code prints out 9 values, which appear to be the custom property values of each individual template/ **UDT** and their parent templates. But, I manually counted 10 custom props, instead of 9.~~

_That was wrong... the `customProps` are from the group template, meaning the second nested template._

Print output:

```python
[0, 0, 0, 0
, UDTProperty[type=_types_/Power_Supply_,path=<null>]
, UDTProperty[type=_types_/Power_Supply_,path=<null>]
, UDTProperty[type=_types_/Power_Supply_,path=<null>]
, 7, u'07']

```

Can I assign a value to the parameters from here? If so, how do I target a specific one? Like `template.templateParams['toggle_main'] = 0`?

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [January 14, 2025, 7:13pm UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/6 "2025-01-14T19:13:11Z")

</div>

I think I found something here:

```python
repeater = event.source.parent.getComponent('Template Repeater 2')
templateList = repeater.getLoadedTemplates()
for template in templateList:
	template.dynamicProps['tog_1'].value = 1
	print template.dynamicProps['tog_1'].value

```

It seems I can write to a specific template parameter with the above code.

BUT, the changes are not reflected in the components that are bound to said parameter, so that tells me I am not really writing to it.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 14, 2025, 7:27pm UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/7 "2025-01-14T19:27:18Z")

</div>

Have you tried this?

```python
template.tog_1 = 1

```

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [January 14, 2025, 9:27pm UTC](https://forum.inductiveautomation.com/t/group-container-or-template-repeater/100745/8 "2025-01-14T21:27:42Z")

</div>

Well then... that is simple and sweet! Thank you, Phil!
