# Vision - Limit rows on a table or remove vertical scroll

**URL:** <https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825>\
**Category:** Ignition\
**Tags:** ignition80, ignition81, vision\
**Created:** [July 12, 2022, 10:51pm UTC](https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825 "2022-07-12T22:51:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmiroclosa](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gmiroclosa/32/21572_2.png) [@gmiroclosa](https://forum.inductiveautomation.com/u/gmiroclosa)\
**Post date:** [July 12, 2022, 10:51pm UTC](https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825/1 "2022-07-12T22:51:45Z")

</div>

Hi everybody,  
How could I limit the number of rows on a table?¿ Is it possible to remove the vertical scroll and keep the lasts X rows visible?¿  
Thanks in advance,  
Guillem

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [July 13, 2022, 2:48am UTC](https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825/2 "2022-07-13T02:48:55Z")

</div>

You can limit the number of rows by using a LIMIT claus in your query that populates the table.

How are you populating the table, from a database ? [SQL LIMIT claus](https://www.w3schools.com/mysql/mysql_limit.asp)

---

<div class="post-metadata">

**Author:** ![gmiroclosa](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gmiroclosa/32/21572_2.png) [@gmiroclosa](https://forum.inductiveautomation.com/u/gmiroclosa)\
**Post date:** [July 13, 2022, 7:27am UTC](https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825/3 "2022-07-13T07:27:46Z")

</div>

> [@craigb](#):
>
> g a LIMIT claus in your query that populates the table.
> 
> How are you populating the table, from a database ? [SQL LIMIT claus](https://www.w3schools.com/mysql/mysql_limit.asp)

Hi CraigB  
Thanks for your answer.  
No, It is not a query. I get the values from a function - Alarm events.  
There is any way to limit the rows there?¿

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 13, 2022, 11:34am UTC](https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825/4 "2022-07-13T11:34:34Z")

</div>

Not in the alarm status or journal tables directly, you would need to make your own.

Something like this should help.

```python
# Get all alarms and get the latest 'limit' number of items

limit = 5

# End up with a PyDataSet, so that we can easily slice it.
alarms = system.dataset.toPyDataSet(system.dataset.sort(system.alarm.queryStatus().getDataset(), 'EventTime', False))

newDataSet = alarms[:limit]

```

---

<div class="post-metadata">

**Author:** ![gmiroclosa](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gmiroclosa/32/21572_2.png) [@gmiroclosa](https://forum.inductiveautomation.com/u/gmiroclosa)\
**Post date:** [July 14, 2022, 9:32pm UTC](https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825/5 "2022-07-14T21:32:21Z")

</div>

> [@JordanCClark](#):
>
> ```python
> limit = 5
> 
> # End up with a PyDataSet, so that we can easily slice it.
> alarms = system.dataset.toPyDataSet(system.dataset.sort(system.alarm.queryStatus().getDataset(), 'EventTime', False))
> 
> newDataSet = alarms[:limit]
> 
> ```

Many Thanks JordanCClark,  
but I don't see where to call the script...  
I use directly a Power table

---

<div class="post-metadata">

**Author:** ![chandler](https://avatars.discourse-cdn.com/v4/letter/c/e9a140/32.png) [@chandler](https://forum.inductiveautomation.com/u/chandler)\
**Post date:** [July 14, 2022, 10:06pm UTC](https://forum.inductiveautomation.com/t/vision-limit-rows-on-a-table-or-remove-vertical-scroll/61825/6 "2022-07-14T22:06:38Z")

</div>

You could make a custom property on the power table that contains all of the data, then run Jordan’s script in the `propertyChange` script of the power table. When the value of the custom property changes, you would use Jordan’s code to get the smaller dataset and write that value to the data property of the table.
