# Count Check boxes on Power table

**URL:** <https://forum.inductiveautomation.com/t/count-check-boxes-on-power-table/20491>\
**Category:** Ignition\
**Created:** [November 1, 2018, 7:16pm UTC](https://forum.inductiveautomation.com/t/count-check-boxes-on-power-table/20491 "2018-11-01T19:16:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marias](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@marias](https://forum.inductiveautomation.com/u/marias)\
**Post date:** [November 1, 2018, 7:16pm UTC](https://forum.inductiveautomation.com/t/count-check-boxes-on-power-table/20491/1 "2018-11-01T19:16:43Z")

</div>

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:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/933be1303f9b42858bd4220733fda1ee75f8578f.png)

Thank you in Advance

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 1, 2018, 7:32pm UTC](https://forum.inductiveautomation.com/t/count-check-boxes-on-power-table/20491/2 "2018-11-01T19:32:01Z")

</div>

```auto
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

```

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [November 1, 2018, 7:37pm UTC](https://forum.inductiveautomation.com/t/count-check-boxes-on-power-table/20491/3 "2018-11-01T19:37:55Z")

</div>

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

```auto

	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.

---

<div class="post-metadata">

**Author:** ![marias](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@marias](https://forum.inductiveautomation.com/u/marias)\
**Post date:** [November 1, 2018, 8:43pm UTC](https://forum.inductiveautomation.com/t/count-check-boxes-on-power-table/20491/4 "2018-11-01T20:43:02Z")

</div>

Thank you very much, this is what I needed.

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [November 2, 2018, 8:02pm UTC](https://forum.inductiveautomation.com/t/count-check-boxes-on-power-table/20491/5 "2018-11-02T20:02:46Z")

</div>

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")`
