# Template repeater dataset

**URL:** <https://forum.inductiveautomation.com/t/template-repeater-dataset/18936>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [July 23, 2018, 9:37pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset/18936 "2018-07-23T21:37:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [July 23, 2018, 9:37pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset/18936/1 "2018-07-23T21:37:47Z")

</div>

Is it possible to create the Template Repeater dataset via a script at runtime?

I’m going to be showing a variable number the templates based on a numerical textbox. I need to use the dataset type as I have two custom properties that I need to assign.

I’ve tried to pull the dataset out and add rows using the system but the new template doesn’t show up in the repeater.

This is my testing code that I’m using to try and get it done:

```auto
numInterlocks = event.source.parent.getComponent('numInterlocks').intValue

tempRepeater = event.source.parent.getComponent('interlockRepeater').templateParams

for interlock in range(numInterlocks):
	print 'Doing interlock ' + str(interlock)
	newRow = [interlock,'Standards/C100/Intlk']
	system.dataset.addRow(tempRepeater,newRow)
	
event.source.parent.getComponent('interlockRepeater').templateParams = tempRepeater

```

I don’t get any errors… just the “Doing interlock 0” -\> 4.

Any ideas? Is what I’m trying to do possible?

---

<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:** [July 23, 2018, 9:44pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset/18936/2 "2018-07-23T21:44:54Z")

</div>

`system.dataset.addRow(tempRepeater,newRow)` - the system.dataset calls _return_ a modified dataset (rather than modifying the dataset in place, since datasets are immutable).

Assign the return value to a variable throughout the loop, then assign it back to the component when the loop finishes:

```auto
tempRepeater = event.source.parent.getComponent('interlockRepeater')
updatedParams = tempRepeater.templateParams

for interlock in range(numInterlocks):
	print 'Doing interlock ' + str(interlock)
	newRow = [interlock, 'Standards/C100/Intlk']
	updatedParams = system.dataset.addRow(updatedParams, newRow)
	
tempRepeater.templateParams = updatedParams

```

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [July 24, 2018, 12:22pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset/18936/3 "2018-07-24T12:22:02Z")

</div>

Thanks so much for the help. That worked perfectly.
