Unshelve Multiple Alarms from Table

I have a table that is generated from shelved alarm data. I have the Shelved Path as a column in the table. Currently, I have a button that will grab the (single) selected row’s Shelved Path property from the table and unshelve it using system.alarm.unshelve(). However, this function does take a list of paths and I would like to update it to take a list from a multi-selection on the table. How do I get the multi-selected list from the dataset? I don’t see any of the properties change when I ctrl+select multiple rows in the table.

In Vision, the multi-selection can be retrieved with .getSelectedRows() (or .selectedRows), which will be the list of row indices. You have to loop through that, retrieving the corresponding data from the dataset.

Unfortunately, this is not a bindable property.

Dang, yep. I was using a binding. Guess I’ll have to transition another binding to a script

Trying to do this on a tree view, I get

Traceback (most recent call last):
  File "<event:actionPerformed>", line 1, in <module>
AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'getSelectedRows'

and same for property .selectedRows

That method is only for tables.

turns out .selectedItems works but I get this weird array

array('i', [791, 340, 346])

Java arrays can be iterated just like python lists.

1 Like

Would system.alarm.unshelve(“/*”) unshelve all alarms?