Count Check boxes on Power table

Greetings
I am new to Ignition and I am working on a project using a Power Table to create a checklist
What I am looking for is to count how many “True” values ( or checked check boxes) there are in the Power Table, I do not need to save the values, just show the number and have a “Reset” Button to clear the checked after obtaining the number

Here is a screenshot of how it should look like:

Thank you in Advance

ds = event.source.parent.getComponent('Power Table').data
count = sum(ds.getValueAt(row, "Boolean Column") for row in range(ds.rowCount))
event.source.parent.getComponent("Numeric Text Field").intValue = count
1 Like

Or to use it as a binding.
Create a custom property on the table named Checked as an Integer.
Then under scripting on the the table, under OnCellEdited


	import system
	if colName=='checked':
		cDS = system.dataset.toPyDataSet(self.data)
		if oldValue==1:
			c=-1
		else:
			c=1
		for r in cDS:
			if r['checked']==True:
				c+=1
			else:
				pass
                self.Checked=c

Then bind the numeric label value to the tables Checked custom property.

1 Like

Thank you very much, this is what I needed.

If the datatype of the checked column can be int, you can use the sum expression function.
To show the int value as a checbox, check the Boolean? column in the table customizer.

sum({Root Container.Power Table.data},"checked")

1 Like