# List component select all

**URL:** <https://forum.inductiveautomation.com/t/list-component-select-all/2484>\
**Category:** Archived Topics\
**Created:** [January 5, 2011, 2:59pm UTC](https://forum.inductiveautomation.com/t/list-component-select-all/2484 "2011-01-05T14:59:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pat](https://avatars.discourse-cdn.com/v4/letter/p/8491ac/32.png) [@Pat](https://forum.inductiveautomation.com/u/Pat)\
**Post date:** [January 5, 2011, 2:59pm UTC](https://forum.inductiveautomation.com/t/list-component-select-all/2484/1 "2011-01-05T14:59:31Z")

</div>

I’m populating a List component with a query and I’m trying to use a Check Box to select all of the values in the List. I can use the function addSelectionInterval(start, end) to select the values in the List component, the problem I’m having is determining how many items are in the list for use as the end argument in the function. If I assign an arbitrary large value as the end argument (one larger than the number of values in the List) I will get an ArrayOutOfBounds error when I try to use the function getSelectedValues().

---

<div class="post-metadata">

**Author:** ![dep05d](https://avatars.discourse-cdn.com/v4/letter/d/e495f1/32.png) [@dep05d](https://forum.inductiveautomation.com/u/dep05d)\
**Post date:** [January 5, 2011, 4:50pm UTC](https://forum.inductiveautomation.com/t/list-component-select-all/2484/2 "2011-01-05T16:50:48Z")

</div>

You can use the rowCount property on a dataset.

rowCount = event.source.parent.getComponent(‘List’).data.rowCount  
event.source.parent.getComponent(‘List’).addSelectionInterval(0,rowCount)

Good luck!

Dan

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 5, 2011, 4:59pm UTC](https://forum.inductiveautomation.com/t/list-component-select-all/2484/3 "2011-01-05T16:59:39Z")

</div>

Well you can determine the end by getting the length of the dataset and subtracting one. In scripting something like:`ds = event.source.getComponent("List").data
end = len(fpmi.db.toPyDataSet(ds))`
