# Counting how many row in a table are a certain value

**URL:** <https://forum.inductiveautomation.com/t/counting-how-many-row-in-a-table-are-a-certain-value/95298>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [August 28, 2024, 9:08pm UTC](https://forum.inductiveautomation.com/t/counting-how-many-row-in-a-table-are-a-certain-value/95298 "2024-08-28T21:08:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 28, 2024, 9:08pm UTC](https://forum.inductiveautomation.com/t/counting-how-many-row-in-a-table-are-a-certain-value/95298/1 "2024-08-28T21:08:18Z")

</div>

Is there a way as described in the subject to do this?  
I was thinking something like this but it doesnt work:

```python
len({../Table.props.data}, 'empy_buggy_capacity' >= 81)

```

---

<div class="post-metadata">

**Author:** ![flexware](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/flexware/32/66243_2.png) [@flexware](https://forum.inductiveautomation.com/u/flexware)\
**Post date:** [August 28, 2024, 9:50pm UTC](https://forum.inductiveautomation.com/t/counting-how-many-row-in-a-table-are-a-certain-value/95298/2 "2024-08-28T21:50:03Z")

</div>

Is `empy_buggy_capacity` a column name in your dataset? In this scenario, I would probably pass in an optional filter field into the query (or however you're coming up with the dataset) and filter it there. This is especially true if you want to filter on numeric data, greater / less than, or a range of data.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 28, 2024, 9:58pm UTC](https://forum.inductiveautomation.com/t/counting-how-many-row-in-a-table-are-a-certain-value/95298/3 "2024-08-28T21:58:07Z")

</div>

With my Integration Toolkit:

```python
len(
	where(
		{../Table.props.data},
		it()['empy_buggy_capacity'] >= 81
	)
)

```

Not possible in an expression without my toolkit (unless you use `runScript()`).

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 29, 2024, 9:57am UTC](https://forum.inductiveautomation.com/t/counting-how-many-row-in-a-table-are-a-certain-value/95298/4 "2024-08-29T09:57:13Z")

</div>

If the data doesn't come from a query, and you can't use Phil's integration toolkit:

Add a custom property on the table. I'll call it 'total' because I don't know your system, but find a more explicit name.  
Add a property binding to that prop, bind it to `this.props.data`.  
Then add a script transform:  
If the table's data is in json format:

```python
return sum(1 for v in value if v['empy_buggy_capacity'] >= 81)

```

If it's in dataset format:

```python
return sum(1 for v in value.getColumnAsList(value.getColumnIndex('empy_buggy_capacity')) if v >= 81)

```

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [August 29, 2024, 11:55am UTC](https://forum.inductiveautomation.com/t/counting-how-many-row-in-a-table-are-a-certain-value/95298/6 "2024-08-29T11:55:13Z")

</div>

thanks alot sir
