# Template Repeater for a button -Vision

**URL:** <https://forum.inductiveautomation.com/t/template-repeater-for-a-button-vision/63308>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 23, 2022, 4:54am UTC](https://forum.inductiveautomation.com/t/template-repeater-for-a-button-vision/63308 "2022-08-23T04:54:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [August 23, 2022, 4:54am UTC](https://forum.inductiveautomation.com/t/template-repeater-for-a-button-vision/63308/1 "2022-08-23T04:54:36Z")

</div>

Hi,

I would like to create a template button with parameters like name, buttoncolor and other tag path names.  
I have a static 4 buttons in a window. whenever i click on a button (say “Speed”), button template will be repeated for tags under speed (Line speed, actual speed, set speed etc). And when i click on line speed, corresponding chart will be displayed.  
When i click on another button other than speed (say “Pressure”), buttons created under speed will be vanished and new buttons will be displayed under Pressure.  
I wish to add a template repeater , so whenever i click on a button, params will be passed and chart will be displayed.  
For eg:

I have added the below script under speed,

```auto

event.source.parent.getComponent('Template Repeater').repeatCount =3

repeater = event.source.parent.getComponent('Template Repeater')

templateList = repeater.getLoadedTemplates()

```

Now, i am stuck up with this. I dont knoe how to move further to accomplish the above functinality.

Your ideas are most welcome.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [August 23, 2022, 6:22am UTC](https://forum.inductiveautomation.com/t/template-repeater-for-a-button-vision/63308/2 "2022-08-23T06:22:41Z")

</div>

I like the idea of using an Easy Chart to achieve the functionality you are looking for. With an Easy Chart, the Tag Pen editor allows you to divide your options into selectable groups that can be toggled on and off via checkboxes in one single chart. See the example below:  
 ![EZ Chart Setup Example](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/f/4f186df4ded96de4f6653df8fe98cbb3d30c307a.png)  
**The preceding setup will render as follows:**

 ![EZ Chart Example](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/c/2cca589917b75990bb672f5a6ecfe5e0aa0a4bf5.png)  
Notice how the group boxes to the left of the chart neatly keep the categories separate with their suboptions individually selectable

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [August 23, 2022, 6:33am UTC](https://forum.inductiveautomation.com/t/template-repeater-for-a-button-vision/63308/3 "2022-08-23T06:33:23Z")

</div>

Hi,

Thanks for your idea. I am currently looking for a normal chart in which, for eg: i will be clicking on speed, line speed and other speed buttons will be displayed. Once i select start and end date, click on line speed (for eg), chart will be displayed after clicking the load button.

under Speed btn:

```auto
btnTemplate =event.source.parent.getComponent('Template Repeater')
btnTemplate.visible = True
#btnTemplate.repeatCount =3
#numtmps =3
updParam=btnTemplate.templateParams

check =updParam.getRowCount()
if check == 0:
	newRow =[["Line Speed","actual_machinespeed","set_machinespeed","line_speed_lcl","line_speed_ucl"]]

	updParam = system.dataset.addRows(updParam,newRow)
	

btnTemplate.templateParams=updParam

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/f/3f7c86fba04aa46c8992d6b4a521f3e9b3c84f9f.png)  
Under Load btn:

```auto

event.source.parent.getComponent('Label').visible = True

event.source.parent.StDate =event.source.parent.getComponent('Group').getComponent('stDate').date
event.source.parent.EndDate =event.source.parent.getComponent('Group').getComponent('endDate').date

event.source.parent.Actual = event.source.parent.ActChart
event.source.parent.Set = event.source.parent.SetChart
event.source.parent.LCL = event.source.parent.LCLChart
event.source.parent.UCL = event.source.parent.UCLChart

chartData =event.source.parent.getComponent('Chart').Data
def checkValue():
	if chartData!= None:

		event.source.parent.getComponent('Label').visible = False
	else:
		event.source.parent.getComponent('Label').visible = True
		
system.util.invokeLater(checkValue,5000)

```

Now i could get data in Template parameter dataset, but it is not reflecting in the template parameter in the window after the click.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [August 23, 2023, 3:47am UTC](https://forum.inductiveautomation.com/t/template-repeater-for-a-button-vision/63308/4 "2023-08-23T03:47:20Z")

</div>

I see you edited this yesterday, so I assume you are still looking for a solution.

Perhaps you can adapt this example for this use case:

> [@Update row in template repeater using button (outside from template) click](https://forum.inductiveautomation.com/t/update-row-in-template-repeater-using-button-outside-from-template-click/71582/8):
>
> If your template parameter bindings are bidirectional, you could simply reuse them to build your query arguments. Here is an example script that does this: repeater = event.source.parent.getComponent('Template Repeater') for template in repeater.getLoadedTemplates(): arguments = [] for customProperty in template.dynamicProps: arguments.append(template.getPropertyValue(customProperty)) print arguments #use these arguments for your UPDATE query Edit: replaced getTemplates function with buil…
