Multiply dataset columns with number

That doesn't seem too bad for scripting. Try something like this:

table = event.source.parent.getComponent('Power Table')
#KWdataset = system.tag.queryTagHistory([...])
if isMMBTU:
	KWtoMMBTU_Multiplier = 3
	headers = system.dataset.getColumnHeaders(KWdataset)
	data = [[KWdataset.getValueAt(row, column) if column < 2 else KWdataset.getValueAt(row, column) * KWtoMMBTU_Multiplier 
				for column in range(KWdataset.columnCount)]
			for row in range(KWdataset.rowCount)]
	MMBTUDataset = system.dataset.toDataSet(headers, data)
	table.data = MMBTUDataset
else:
	table.data = KWdataset

Edit: Updated code to reflect the purpose of multiplying columns 2, 3, and 4 by 3

1 Like