Dataset as Template parameter


I have a template in vision in which I have params like Machine Name and 7 other params like day1 data,day2 data and so on.
I would like to create a dataset param in template which holds the 7 params .

At what trigger point should i have to add these 7 values to dataset.
Kindly help me in going forward.

I'm not quite sure what you want. Please elaborate.

I have a template with fields: Label (Machine Name), Num Text field 1 (Data1) . . . Num Text field 7 (Data7)
I have template parameters for above fields as :

Hence i want to populate those 7fields value to PlanDataset.

I have main screen in which this template will be populated based on the selected process,

When i enter the details in above fields i want to save the data.
Currently i am trying in json. But i stuck at (Hence i want to populate those 7fields value to PlanDataset.)

I see.

You need a script attached to your Save button that will use system.dataset.toDataSet() to assemble your dates as header strings and the three rows of data. Or perhaps make a 4-column dataset (with t_stamp as the first column), a static list of four column names, and seven rows of data.

The script would then assign the freshly-created dataset to the template parameter.

There are numerous examples on using this function on the forum. And a few in the manual.

Another solution would be to create a suitable dataset when the template initializes, populated with the correct dates and the rest zeros. Use an editable table to display it. Use the onCellEdited function to update the table's dataset as the operator fills it in. Then the Save button would just copy the table dataset property to the template property.

save script:

import json
import re

tabledata = event.source.parent.getComponent('tmp_Rpt_plan').templateParams
data = system.dataset.toPyDataSet(tabledata)
from com.inductiveautomation.factorypmi.application.components import PMINumericTextField
repeater = event.source.parent.getComponent('tmp_Rpt_plan').getLoadedTemplates()
for row, component in enumerate(repeater):
	data = event.source.parent.getComponent('tmp_Rpt_plan').templateParams
	dsUpdate = []
	for subcomponent in component.getComponents():
		if isinstance(subcomponent, PMINumericTextField):
	event.source.parent.getComponent('tmp_Rpt_plan').templateParams = system.dataset.updateRow(data, row, {'PlanData':dsUpdate[1]})

system.tag.writeBlocking("[client]Plan", tabledata)
jsondata ={}

MachineName ={}

PlanData ={}

MachineID = {}

#tableName ="tbl_productionplan"

childcount = data.getRowCount()

Process = event.source.parent.Process

for a in range(childcount):
	MachineName[a] =data.getValueAt(a,'MachineName')   
	PlanData[a] = data.getValueAt(a,'PlanData')   

MachineID[a]  =data.getValueAt(a,'MachineID')   
jsondata = {'Data':{'MachineID':MachineID,'PlanData':PlanData}}

json_data = json.dumps(jsondata)
params ={"iPlanData":jsondata,"iProcess":Process}
system.db.runNamedQuery("Prod_Plan/InsertPlan",params )

Let me go through your suggestion