# system.alarm.queryStatus与数据库中的记录不同步

**URL:** <https://forum.inductiveautomation.com/t/system-alarm-querystatus/73692>\
**Category:** Ignition\
**Tags:** perspective, ignition80\
**Created:** [May 14, 2023, 3:50pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus/73692 "2023-05-14T15:50:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![471421143](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/471421143/32/38211_2.png) [@471421143](https://forum.inductiveautomation.com/u/471421143)\
**Post date:** [May 14, 2023, 3:50pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus/73692/1 "2023-05-14T15:50:07Z")

</div>

大家好!

 ![3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/2/62f9b548d7c21a0c854396d9229213dbc7bedeb6.png)

我用system.alarm.queryStatus 这条指令获取激活未确认的报警记录,显示有7条报警记录, 但是我在数据库中找不到与之对应的EventID. 如何才能实现报警信息的同步呢?

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/9/89a12b3ff6ab12dc7115f25b48f0601a309c0ce4.png)  
 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/5/35656c3103b8b22458ad20fc7b868aeeecb7090e.png)

---

<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:** [May 14, 2023, 4:24pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus/73692/2 "2023-05-14T16:24:50Z")

</div>

> [@471421143](#):
>
> 我用system.alarm.queryStatus 这条指令 .....

Google translate says:

> I use the command system.alarm.queryStatus to get activated unconfirmed alarm records, and it shows that there are 7 alarm records, but I can’t find the corresponding EventID in the database. How can I realize the synchronization of alarm information?

The `alarm_events` table gets a separate row for every **change** that happens to the status of an alarm. You should use the UUID in your SQL WHERE clause to get the rows that apply to a specific alarm. You may also need to JOIN with the `alarm_event_data` table for additional information. See this part of the documentation:

[https://docs.inductiveautomation.com/display/DOC81/Alarm+Journal#AlarmJournal-TableDefinitions](https://docs.inductiveautomation.com/display/DOC81/Alarm+Journal#AlarmJournal-TableDefinitions)

{Side note: This forum is largely english-speaking. You may get quicker responses if you include a translation of your question. I generally use Google for such, but if you know even a little english, you might be able to adjust the translation to best reflect your meaning.}

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 14, 2023, 4:43pm UTC](https://forum.inductiveautomation.com/t/system-alarm-querystatus/73692/3 "2023-05-14T16:43:55Z")

</div>

quertStatus returns an list of alarms, so to get the IDs, you will need to iterate through the list and get them:

```auto
state = ['ActiveUnacked']
alarms = system.alarm.queryStatus(state = state)
for alarm in alarms:
	print alarm.id

```

Here is a tutorial that details how to get the other alarm properties in this manner as well:

> [@Print notes of acknowledged alarms](https://forum.inductiveautomation.com/t/print-notes-of-acknowledged-alarms/69430/3):
>
> If you want to get the information directly from the selected alarms in the alarm status table, here is a guide to doing it. Currently, there are 23 properties that show up in the standard alarm status table model. The columns are indexed 0 through 22, and each specific column retains its specific model index no matter how the columns are arranged or rearranged in the table. Here is a map of the columns: # Model Index Column Name # 0 ackNotes # 1 Ack Time # 2 Ack'ed By # 3 …
