I have a table with manually entered values. I’m attempting to write each “cell” to a tag using button component scripting. Using for loops I’m able to map nearly the entire matrix to individual tags, however the final column is a summation linked to custom properties with expression binding dependent on column values entered by the user. The code below is incorrect:
[code]rows = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
cols = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
pathMat = “MAT/Lines/”
linesTrackingData = event.source.parent.getComponent(“Material Tracking”).data
pathTotal = “MAT/Lines/Total/Total”
linesTracking = event.source.parent.getComponent(“Material Tracking”)
for row in rows:
tempTotal = “linesTracking.Total” + str(row)
system.tag.write(pathTotal + str(row), float(tempTotal))
for col in cols:
tempMat = pathMat + str(row) + “/” + str(col)
system.tag.write(tempMat, linesTrackingData.getValueAt(row, col))[/code]
I need to insert a variable (row) into the component’s custom property name within the for loop to avoid coding 24 individual tag assignments.