# How to get the last alarm?

**URL:** <https://forum.inductiveautomation.com/t/how-to-get-the-last-alarm/23014>\
**Category:** Ignition\
**Created:** [March 2, 2019, 2:26pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-last-alarm/23014 "2019-03-02T14:26:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [March 2, 2019, 2:26pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-last-alarm/23014/1 "2019-03-02T14:26:25Z")

</div>

How can I get the last (by time) occurred Unack and Active or Ack and Active alarm from  
system.alarm.queryStatus function?

I want to display in the label the time and the text(name or label) only of the last alarm…

---

<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:** [March 2, 2019, 3:45pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-last-alarm/23014/2 "2019-03-02T15:45:34Z")

</div>

> results = system.dataset.sort(system.alarm.queryStatus(source=["_YourSourceTagPath_"]).getDataset(),3,False).getValueAt(0,2)  
> print results

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [March 2, 2019, 6:27pm UTC](https://forum.inductiveautomation.com/t/how-to-get-the-last-alarm/23014/3 "2019-03-02T18:27:53Z")

</div>

That’s it!  
Thank you. 👍
