I would recommend against trying to do this with a 'value change' script - instead, just add a transform to your data fetch.
If you're pulling the data out of a database already, then it should be fairly easy to write a transform - something like the process defined here (although that post assumes your data is coming in as a dataset, not a json array):
I don't see any big problems with your script. Coping the values into the updatedData
list and then looping over that list is unnecessary - you could just loop through the table's data array directly:
table = self.getSibling("Table")
recipeID = self.getSibling("Dropdown").props.value
#pulling updated values from table and putting into a list
for row in table.props.data:
newValue = row['CONTROL SP']
ID = row['ID']
params = {
"id": ID,
"recipeId": recipeId,
"newValue": newValue
}
system.db.runNamedQuery('ProjName', 'UpdateQueries/ControlSetpoints', params)
table.refreshBinding("props.data")