# Expression function binding to limit dataset without doing a script

**URL:** <https://forum.inductiveautomation.com/t/expression-function-binding-to-limit-dataset-without-doing-a-script/87547>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 19, 2024, 12:53pm UTC](https://forum.inductiveautomation.com/t/expression-function-binding-to-limit-dataset-without-doing-a-script/87547 "2024-03-19T12:53:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [March 19, 2024, 12:53pm UTC](https://forum.inductiveautomation.com/t/expression-function-binding-to-limit-dataset-without-doing-a-script/87547/1 "2024-03-19T12:53:12Z")

</div>

I have a dataset like image below,  
I'am look a expression function binding or a simple solution to limite row data on the a table  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/e/ceb41bc5f365b552c67ce6e963072305e013efd3.png)

I would like to get 20 first rows of table.

---

<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:** [March 19, 2024, 1:01pm UTC](https://forum.inductiveautomation.com/t/expression-function-binding-to-limit-dataset-without-doing-a-script/87547/2 "2024-03-19T13:01:57Z")

</div>

My Integration Toolkit module's [where()](https://www.automation-pros.com/toolkit/doc/iteration.html#where) expression function can do this easily:

```auto
where({Root Container.path.to.source.dataset}, idx()<20)

```

---

<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:** [March 19, 2024, 1:54pm UTC](https://forum.inductiveautomation.com/t/expression-function-binding-to-limit-dataset-without-doing-a-script/87547/3 "2024-03-19T13:54:50Z")

</div>

If you can't use Phil's toolkit, the simplest way to do this would probably be:

```python
new_ds = system.dataset.toDataSet(
	list(ds.columnNames),
	system.dataset.toPyDataSet(ds)[:20]
)

```

Probably not the most performant, but it doesn't get much simpler than this.

Note that if you just want to display it in a table, you can skip the conversion back to a dataset.

edit:  
actually, this is even simpler, and more performant:

```python
new_ds = system.dataset.deleteRows(ds, range(20, ds.rowCount))

```

---

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [March 21, 2024, 12:47pm UTC](https://forum.inductiveautomation.com/t/expression-function-binding-to-limit-dataset-without-doing-a-script/87547/4 "2024-03-21T12:47:08Z")

</div>

> [@pascal.fragnoud](#):
>
> `new_ds = system.dataset.deleteRows(ds, range(20, ds.rowCount))`

Merci @pascal.fragnoud
