Template repeater dataset rows delete -Vision

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

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:

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

or

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

depending on the button.

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!.

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

Please check the attached snaps fyi

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


What data is in this dataset?


Please check

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

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.

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.

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:

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)
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

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

Is there any way to delete the rows in template parameters dataset.
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, but pay special attention to the note on that page.

Thanks Mr.Zacht ,
Will look into it