# Scripting on Alarm status table

**URL:** <https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722>\
**Category:** General Discussion\
**Tags:** vision, scripting\
**Created:** [September 16, 2020, 12:43am UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722 "2020-09-16T00:43:46Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.omair.amin](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@m.omair.amin](https://forum.inductiveautomation.com/u/m.omair.amin)\
**Post date:** [September 16, 2020, 12:43am UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/1 "2020-09-16T00:43:46Z")

</div>

Hello everyone,

I am trying to write a script which will function as follow:

- One alarm must be selected from alarm status table.  
-Once the alarm is selected, a button will be pressed to show the display path of the selected alarm in text box.

Is it do-able? If yes, any help will be appreciated.  
Thank you

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 16, 2020, 4:28am UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/2 "2020-09-16T04:28:36Z")

</div>

The Alarm Status Table doesn’t provide any visibility into a user’s selection of rows, either through props or Component Events. Due to this, there is no way to track what row a user has selected.

The only way available to use ANY external component to display any info about an alarm in the Alarm Status Table (selected or not) is if filtering is applied to the table (`AlarmStatusTable.props.filters` object) and `AlarmStatusTable.props.filters.active.results.enabled` is `true`. If those conditions are met, you have access to the alarm object within `AlarmStatusTable.props.filters.active.results.data`, and so you could obtain the Display Path from that object.

 ![Screen Shot 2020-09-15 at 9.26.10PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/3/53553da5c35f0d3b7122ae73e0ba41105451c962.png)  
Note that this filtering is NOT the same filtering as that which is applied through the Alarm Status Table’s UI - this filtering is entirely done through property manipulation, and so you would need to manage it with additional inputs like Text Fields.

---

<div class="post-metadata">

**Author:** ![Ethan.Strike](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethan.strike/32/13809_2.png) [@Ethan.Strike](https://forum.inductiveautomation.com/u/Ethan.Strike)\
**Post date:** [September 16, 2020, 1:00pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/3 "2020-09-16T13:00:15Z")

</div>

It may be possible to have a named query binding to a dataset on a table. Although you won’t have access to the built-in alarm status table functionality, you can script with python to show, hide, or alter the data as needed by using that dataset.

Official 8.0 Docs for [Alarm Status Table](https://docs.inductiveautomation.com/display/DOC80/Vision+-+Alarm+Status+Table), [Vision Table](https://docs.inductiveautomation.com/display/DOC80/Vision+-+Table), [Named Query Bindings](https://docs.inductiveautomation.com/display/DOC80/Named+Query+Bindings#NamedQueryBindings-UsingNamedQueriesonDatasetProperties), [Datasets](https://docs.inductiveautomation.com/display/DOC80/Datasets), and [Python Scripting](https://docs.inductiveautomation.com/display/DOC80/Python+Scripting).

(Note: Keep in mind that [Python Datasets](https://docs.inductiveautomation.com/display/DOC80/system.dataset.toDataSet) and [Ignition Datasets](https://docs.inductiveautomation.com/display/DOC80/system.dataset.toPyDataSet) need to be converted for usage with the other, otherwise they may not play nicely with each other

Datasets are also [immutable](https://docs.inductiveautomation.com/display/DOC80/Datasets#Datasets-AlteringaDataset). So you must assign the returned dataset to a new variable to be able to alter the values)

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [September 16, 2020, 4:55pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/4 "2020-09-16T16:55:46Z")

</div>

In 7.9x we use the onDoubleClicked Extension function to do something similar.

```auto
print str(alarmEvent.get('DisplayPath'))

```

Will print the double clicked alarms display path to the console.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 16, 2020, 4:57pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/5 "2020-09-16T16:57:58Z")

</div>

@MMaynard: The Perspective Alarm Status Table does not pass AlarmEvent objects to interaction Events, so that won’t work if he’s using Perspective.

 ![Screen Shot 2020-09-16 at 9.57.01AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/e/2e6a6fad93586291c93ecd647bc5976a16f241c0.png)

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [September 16, 2020, 5:00pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/6 "2020-09-16T17:00:40Z")

</div>

He didn’t specify perspective 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 16, 2020, 5:02pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/7 "2020-09-16T17:02:51Z")

</div>

😳

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 16, 2020, 5:12pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/8 "2020-09-16T17:12:35Z")

</div>

I automatically defaulted to Perspective, when @MMaynard is correct - you didn’t specify Perspective. I still believe you are asking about Perspective because Vision actually provides access to a dataset of the currently selected alarms, but here’s how you could obtain your desired behavior in Vision:

Place a Label and a Button.  
As part of the Button’s `onActionPerformed` or `onClick` Event, supply a Script with the following code:

```auto
display_path = event.source.parent.getComponent('Alarm Status Table').selectedAlarms.getValueAt(0, 'DisplayPath')
event.source.parent.getComponent('Label').text = display_path

```

Note that this does not prevent a user from selecting multiple alarms, and if they do so it will only display the path of the FIRST alarm selected. This code does also not prevent an error from occurring should NO alarms be selected.

---

<div class="post-metadata">

**Author:** ![m.omair.amin](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@m.omair.amin](https://forum.inductiveautomation.com/u/m.omair.amin)\
**Post date:** [September 17, 2020, 5:03am UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/9 "2020-09-17T05:03:02Z")

</div>

Thank you for your reply. I am using vision.

---

<div class="post-metadata">

**Author:** ![m.omair.amin](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@m.omair.amin](https://forum.inductiveautomation.com/u/m.omair.amin)\
**Post date:** [September 19, 2020, 1:25am UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/10 "2020-09-19T01:25:59Z")

</div>

@cmallonee I have used your code. When I click the button, the label turns blank white and does not return display path.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 19, 2020, 3:22am UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/11 "2020-09-19T03:22:01Z")

</div>

1. Verify there are no errors present in the logs.
2. Is there at least one alarm selected? Have you verified the alarm which is selected does indeed have a display path? I don’t believe alarms have display paths by default (at least, I’m looking at several right now which do not have a display path).

---

<div class="post-metadata">

**Author:** ![m.omair.amin](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@m.omair.amin](https://forum.inductiveautomation.com/u/m.omair.amin)\
**Post date:** [September 19, 2020, 4:17am UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/12 "2020-09-19T04:17:02Z")

</div>

@cmallonee Check out the second column named as display path. I am trying to grab this one.

 ![Alarms Status](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/9/896e5b07e21328cead210294886d32b83b54351e.jpeg)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [September 19, 2020, 2:12pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/13 "2020-09-19T14:12:47Z")

</div>

Don’t be deceived: If no Display Path is explicitly set for an alarm, I believe we just toString() the original path IN THE TABLE. This does not mean that an alarm actually has a Display Path property in the Dataset.

 ![Screen Shot 2020-09-19 at 7.10.40AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1a5fc30f8d00d5935cffba9cc5872644e5466ed7.png)

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [April 13, 2025, 1:31pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/14 "2025-04-13T13:31:08Z")

</div>

Im using this script with success to help troubleshoot alarm source paths. Is there anyway to extract the OPC item path associated with the alarm also?

---

<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:** [April 13, 2025, 4:21pm UTC](https://forum.inductiveautomation.com/t/scripting-on-alarm-status-table/38722/15 "2025-04-13T16:21:10Z")

</div>

You'll have to read it from the tag. Not all alarms are on OPC tags, so that isn't a generic feature of alarms.
