v8.0.16 vision
I have a power table with a column for cost. I want to sum up the rows and display the total cost for all rows. What is the best way to display this, just plop under the corresponding column and setup up layout accordingly and hope it will line up? I kind of want this to look like a report where you can add a total line.
Any tips from the pros on this?
bump
If you want the sum to be a part of the table, you’ll have to add a row that contains the same column count and types. I would put a custom property on the table named rawData
and put your binding on that. Then add a propertyChange
script on the table that does something like the following. This assumes you have 2 columns, the first is of type string and the second is the one you want to sum.
if event.propertyName == 'rawData':
sum = 0
for row in range(event.source.rawData.rowCount):
sum += event.source.rawData.getValueAt(row, 1)
summaryRow = ['Sum', sum]
event.source.data = system.dataset.addRow(event.source.rawData, summaryRow)
2 Likes