# How to get total alarm duration and occurrences by alarm

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-total-alarm-duration-and-occurrences-by-alarm/10873>\
**Category:** Ignition\
**Created:** [December 4, 2015, 1:12pm UTC](https://forum.inductiveautomation.com/t/how-to-get-total-alarm-duration-and-occurrences-by-alarm/10873 "2015-12-04T13:12:30Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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 4, 2015, 4:48pm UTC](https://forum.inductiveautomation.com/t/how-to-get-total-alarm-duration-and-occurrences-by-alarm/10873/4 "2015-12-04T16:48:02Z")

</div>

Hmm. Looking closer, this is a bit tricky. First, the alarm journal component doesn’t let you bind to the full list of alarms – just the dataset for the selected alarm. But it does have an ‘alarms’ property, which is a dataset of the displayed alarms. Just like the getDataset() method of the list from the system.alarm.queryJournal() script function.  
So, first you have to get the alarms into a bindable dataset. A custom dataset property ‘alarmData’ on your table with an objectScript() expression can retrieve that unbindable property:`objectScript('binding.target.parent.getComponent("Alarm Journal").alarms',
  now(1000))`Then you can process that dataset into a descending list of frequencies by binding the table’s ‘data’ property with the view() expression:`view("Select Source, len(EventState) As Times "+
  "Where EventState==0 "+
  "Group By Source "+
  "Order By -Times",
  {Root Container.Table.alarmData})`The view() expression function doesn’t have a LIMIT clause yet. I’ll add that to my to-do list. 🙂  
The durations are even more tricky. Let me think about that.

---

_[View the full topic](https://forum.inductiveautomation.com/t/how-to-get-total-alarm-duration-and-occurrences-by-alarm/10873)._
