# Dataset Expression Row Count

**URL:** <https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [October 21, 2021, 5:32pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220 "2021-10-21T17:32:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [October 21, 2021, 5:32pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/1 "2021-10-21T17:32:59Z")

</div>

I have a dataset and I would like to check to see if the dataset contains any rows in an expression binding. I know to access the dataset values, you use “Dataset\_Expression [x,y]”. Is there a way to check how many rows are in the dataset, similar to data.getRowCount()?

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [October 21, 2021, 5:38pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/2 "2021-10-21T17:38:10Z")

</div>

You should be able to check the row count of a dataset in the expression language by simply using the len() function:

```auto
len({referenceToDataset})

```

---

<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:** [October 21, 2021, 6:20pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/3 "2021-10-21T18:20:54Z")

</div>

> [@swolnisty](#):
>
> You should be able to check the row count of a dataset in the expression language by simply using the len() function:

~~Note that this capability of the `len()` expression is new in 8.1.8, for any users still on an older version.~~

---

<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:** [October 21, 2021, 6:26pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/4 "2021-10-21T18:26:53Z")

</div>

> [@paul-griffith](#):
>
> new in 8.1.8

Do you mean somewhere it broke and was fixed for 8.1.8? Because this functionality goes way back.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 21, 2021, 6:29pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/5 "2021-10-21T18:29:41Z")

</div>

I think he’s mixed up adding expanded support for arrays and collections. Looks like the `len` function has supported DataSets for a long time.

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [July 25, 2023, 11:12am UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/6 "2023-07-25T11:12:52Z")

</div>

How to get the length of a disticnt column values inside a dataset ?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 25, 2023, 11:20am UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/7 "2023-07-25T11:20:25Z")

</div>

All the columns will have the same length and this will be the length of the dataset.

Are you asking how to get the maximum string length in a particular dataset column? (If so then this should have been asked as a new thread as it is not related to this one.)

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 27, 2024, 10:17pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/8 "2024-02-27T22:17:28Z")

</div>

Can I use python's len function to do the same thing within a script?

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [February 27, 2024, 10:24pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/9 "2024-02-27T22:24:42Z")

</div>

I'm not sure, I would probably just stick with the default dataset scripting functions in Ignition:

```auto
dataset.getRowCount()

```

---

<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:** [February 27, 2024, 10:33pm UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/10 "2024-02-27T22:33:49Z")

</div>

Not for any arbitrary dataset. PyDatasets, yes.

---

<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:** [February 28, 2024, 12:02am UTC](https://forum.inductiveautomation.com/t/dataset-expression-row-count/52220/11 "2024-02-28T00:02:08Z")

</div>

Slightly more efficient, and easier on the eyes:

```auto
dataset.rowCount

```
