# Template repeater dataset rows delete -Vision

**URL:** <https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 23, 2022, 2:21pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330 "2022-08-23T14:21:26Z")\
**Posts on this page:** 13\
**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, 2:21pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/1 "2022-08-23T14:21:26Z")

</div>

Hi,

I wish to delete the template parameters in the dataset on button click. and on another click, i would like to add the template parameters. How to handle it via script?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [August 23, 2022, 2:27pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/2 "2022-08-23T14:27:32Z")

</div>

Are the parameters you’re adding always the same?

If so, you could add two custom properties to your template, `blankDataset` and `fullDataset`, populated appropriately. Your button action script would then look like:

```auto
# to blank the params
repeater = event.source.parent.getComponent('Template Repeater')
repeater.templateParams = repeater.blankDataset

```

or

```auto
# to insert the params
repeater = event.source.parent.getComponent('Template Repeater')
repeater.templateParams = repeater.fullDataset

```

depending on the button.

---

<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, 2:30pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/3 "2022-08-23T14:30:13Z")

</div>

Thanks Mr.Zacht, Thats a very good idea.

I have added the dataset in custom properties of template. But i am unable to see the dataset in the template repeater. Idk what i am missing!.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [August 23, 2022, 2:32pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/4 "2022-08-23T14:32:01Z")

</div>

Have you assigned a `Template Path`?  
What data is in your `Template Parameters`? (a screenshot would be useful)

---

<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, 2:33pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/5 "2022-08-23T14:33:03Z")

</div>

Please check the attached snaps fyi

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [August 23, 2022, 2:35pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/6 "2022-08-23T14:35:16Z")

</div>

On your template instance there’s a property called `Template Parameters`.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/b/eb5bd077a40142a6f32cf2c392feed92364552a3.png)  
What data is in this dataset?

---

<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, 2:36pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/7 "2022-08-23T14:36:24Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7dbba6e6e128bf70833268cc60d283d7df789339.png)  
Please check

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [August 23, 2022, 2:41pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/8 "2022-08-23T14:41:56Z")

</div>

I understand now. You don’t want to add `fullDataset` as one of your Template Parameters. You can delete it from there. You want to add it as a custom property of the template instance.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/4/e49a77c60b915523a4eb4abb81c75aa8b1b64249.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/ca7eae8f0bcb053dacc2061bf2e539d66749a6f9.png)

You’re really just using these as shelves where you store the two possible configurations. One button will take the blank configuration (`blankDataset`) off the shelf and plug it into the `Template Parameters` property. The other button will do the same but with the `fullDataset` property.

---

<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, 2:45pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/9 "2022-08-23T14:45:42Z")

</div>

Thanks for your inputs,

But the thing is, on clicking the speed button, 3 buttons will be displayed. And on clicking any of these button, i will be passing the tagpaths (via template params) to charts (when load btn is clicked) and when i click on diameter (template params will be deleted and new params will be added), 2 buttons will be displayed.

```auto
code under speed btn:
event.source.parent.EasyChart = False
btnTemplate =event.source.parent.getComponent('Template Repeater')
btnTemplate.visible = True
#btnTemplate.repeatCount =1
#numtmps =3
updParam=btnTemplate.templateParams
#
check =updParam.getRowCount()
if check == 0:
	newRow =[["Line Speed","actual_machinespeed","set_machinespeed","line_speed_lcl","line_speed_ucl"],
			["Ext1 Speed","actual_extruder1_speed","set_extruder1_speed","extruder1_speed_lcl","extruder1_speed_ucl"],
			["Ext2 Speed","actual_extruder2_speed","set_extruder2_speed","extruder2_speed_lcl","extruder2_speed_ucl"]]
				
	
	

	#newRow =["Line Speed"]
	updParam = system.dataset.addRows(updParam,newRow)
	#event.source.parent.getComponent('Text Field').text="Test"

btnTemplate.templateParams=updParam

```

code under Load btn:

```auto
event.source.parent.getComponent('Label').text ="LOADING. . ."
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

vRead=system.tag.readBlocking("[client]Param Name")[0].value

if vRead != None:
	
	vSplit =vRead.split('|')

	if( (vSplit[0]=="Line Speed") or (vSplit[0]=="Ext1 Speed") or (vSplit[0]=="Ext2 Speed") or (vSplit[0]=="Performance") or (vSplit[0]=="Temperature") ):

		event.source.parent.ActChart=vSplit[0]
		event.source.parent.SetChart=vSplit[1]
		event.source.parent.LCLChart=vSplit[2]
		event.source.parent.UCLChart=vSplit[3]

else:
	event.source.parent.getComponent('Label').text ="NO DATA AVAILABLE"
	
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)

```

```auto
Code (rough) under diameter:
ds =event.source.parent.getComponent('Template Repeater')

row =ds.templateParams

if row != None:
	ds = system.dataset.deleteRows(ds,row)
	event.source.parent.getComponent('Template Repeater').templateParams = ds

```

Your ideas are most welcome

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [August 23, 2022, 2:48pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/10 "2022-08-23T14:48:59Z")

</div>

Yeah it seems like I misunderstood your goal here. Sorry about that. If you need to build a dataset in a script, look into [system.dataset.toDataSet - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.dataset.toDataSet)

---

<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, 2:50pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/11 "2022-08-23T14:50:43Z")

</div>

Is there any way to delete the rows in template parameters dataset.  
Normal dataset logics not working here.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [August 23, 2022, 3:11pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/12 "2022-08-23T15:11:27Z")

</div>

> [@Dharani\_T](#):
>
> Normal dataset logics not working here

I don't understand what you mean by this. The `Template Parameters` property of a template repeater component is a normal dataset. You can try using [system.dataset.deleteRow - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.dataset.deleteRow), but pay special attention to the note on that page.

> [@](#):
>
> **Note:** Datasets are immutable, which means they cannot be directly modified once created. Instead, this scripting function returns a new dataset with some modification applied, which must be assigned to a variable to be used. See [Altering a Dataset](https://docs.inductiveautomation.com/display/DOC81/Datasets#Datasets-AlteringaDataset).

---

<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, 3:13pm UTC](https://forum.inductiveautomation.com/t/template-repeater-dataset-rows-delete-vision/63330/13 "2022-08-23T15:13:06Z")

</div>

Thanks Mr.Zacht ,  
Will look into it
