How do I count the selected rows? [SOLVED]

Similar to how len() works but instead of giving the total number of rows, is there like a “count” equivalent in ignition? I want to be able to count the selected rows in either a table, a tree view or a list.

I have a tree view that allows users to select multiple rows and was hoping I could count how many rows they have selected.


Thank you for your help.

You can get the number of rows in a dataset named data using data.rowCount or data.getRowCount().
I don’t know if one is better than the other.

Tested with the dataset behind a Power Table in Vision.

pt = event.source.parent.getComponent('Power Table')
data =
print data.getRowCount()

is there a getRowCount() for tree view? I’m currently using a tree view component.

The table has a getSelectedRowCount()

The Tree View has a getSelectedItems() or getSelectedPaths() which you can then use the len() function on.

itemCount = len(event.source.getSelectedItems())

The List has a getSelectedValues() which you can then use the len() function on.

valueCount = len(event.source.getSelectedValues())

Of course if you want to loop through those you don’t need the count

for item in event.source.getSelectedItems():
    print item

awesome, this works. thank you!