# Selecting multiple vision table rows from python?

**URL:** <https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331>\
**Category:** Ignition\
**Created:** [July 6, 2019, 9:48pm UTC](https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331 "2019-07-06T21:48:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![waldner](https://avatars.discourse-cdn.com/v4/letter/w/a5b964/32.png) [@waldner](https://forum.inductiveautomation.com/u/waldner)\
**Post date:** [July 6, 2019, 9:48pm UTC](https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331/1 "2019-07-06T21:48:57Z")

</div>

I’m not able to select multiple rows in a vision table using python. The selection mode in the table is set to “multiple interval”, however the following code always selects a single line (the last), instead of lines 0, 2, 4 etc.:

```auto
for row in range(0, mytable.data.getRowCount(), 2):
  mytable.setRowSelectionInterval(row, row)

```

As far as I can tell there’s no setSelectedRows() function or similar. Am I missing something?

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [July 7, 2019, 4:11am UTC](https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331/2 "2019-07-07T04:11:53Z")

</div>

Use:

```auto
table = event.source.parent.getComponent('Power Table 1').getTable()

table.getSelectionModel().addSelectionInterval(0, 0)
table.getSelectionModel().addSelectionInterval(2, 2)
table.getSelectionModel().addSelectionInterval(4, 6)

```

---

<div class="post-metadata">

**Author:** ![waldner](https://avatars.discourse-cdn.com/v4/letter/w/a5b964/32.png) [@waldner](https://forum.inductiveautomation.com/u/waldner)\
**Post date:** [July 8, 2019, 3:40pm UTC](https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331/3 "2019-07-08T15:40:36Z")

</div>

So a power table is needed? May then I ask for a setSelectedRows(list\_of\_rows\_to\_select) to be added to the table component as a feature request? Thanks

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [July 8, 2019, 4:06pm UTC](https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331/4 "2019-07-08T16:06:58Z")

</div>

No, basic table works too. Just create your own function.

```auto
def setSelectedRows(table, rows):
	for row in rows:
		table.getSelectionModel().addSelectionInterval(row,row)
		
table = event.source.parent.getComponent('Table').getTable()
setSelectedRows(table, [0,2,4,5,6])

```

---

<div class="post-metadata">

**Author:** ![dwb](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@dwb](https://forum.inductiveautomation.com/u/dwb)\
**Post date:** [December 20, 2022, 1:06pm UTC](https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331/5 "2022-12-20T13:06:39Z")

</div>

Hi,  
Is there a way to do the same in Perspective? I'd like to select all the rows in the table.  
Thanks.

---

<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:** [December 20, 2022, 2:04pm UTC](https://forum.inductiveautomation.com/t/selecting-multiple-vision-table-rows-from-python/26331/6 "2022-12-20T14:04:19Z")

</div>

You've asked this all over the forum. The same people who've seen your other questions are the ones who see this question. (This forum really isn't that large.)

Vision is so fundamentally different from Perspective that nearly **nothing** transfers in regards to component behavior. Perspective has different components from Vision. Totally different code under the hood for _ **all of them** _. You are going to have to wait until IA implements the behavior you want, or create your own table component with the SDK.
