Memory Tag > Dataset Type, update cell value update using script

Hello Everyone,

I am trying to update a cell value using a numerical input component in a memory tag of data set type.
Every time the value in numerical input changes the script runs and change/update the value in required row/column.
Similarly, I have multiple numerical input component to update different column values.
Initially when i change the value from 1st numerical input component, the value change in the required cell, but on changing value from 2nd numerical input component the previously changed value is reset to initial one. I don’t want it to happen and keep both the newly changed value.
Any help with same will be appreciated.
Attaching image for reference.

Consider using a button to confirm the values, then update the dataset once. Also, consider the use of system.dataset.updateRow() to simplify your script.

dsTagName = '[default]PPOH_Demand1'
tbl ='[default]PPOH_Demand1').value
flt = event.source.parent.getComponent('Filter 1').getComponent('Popup Calendar').formattedDate

#Use path to the value components here 
demand = event.source.parent.getComponent('Demand Value').intValue
attainment = event.source.parent.getComponent('Attainment Value').intValue

for i in range(tbl.getRowCount):
	if, 'Month')) == flt:
		tbl = system.dataset.updateRow(tbl, i, {'Month':, 'Demand_1st' : demand, 'BuildAttainment_1st':attainment})

system.tag.write(dsTagName, tbl)
1 Like

As an aside, instead of using a screenshot of your script, you can paste it into your post, highlight it, then use the Preformatted Text button </>. It will make things easier for others to troubleshoot. :wink:

1 Like