# Trouble getting Alarm Journal parameters to table

**URL:** <https://forum.inductiveautomation.com/t/trouble-getting-alarm-journal-parameters-to-table/98769>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 19, 2024, 7:27am UTC](https://forum.inductiveautomation.com/t/trouble-getting-alarm-journal-parameters-to-table/98769 "2024-11-19T07:27:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Learner\_Ignition](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@Learner\_Ignition](https://forum.inductiveautomation.com/u/Learner_Ignition)\
**Post date:** [November 19, 2024, 7:27am UTC](https://forum.inductiveautomation.com/t/trouble-getting-alarm-journal-parameters-to-table/98769/1 "2024-11-19T07:27:33Z")

</div>

Hi  
I am trying to store couple of alarm journal parameters into table.

```python
state = ["ClearUnacked", "ClearAcked"]
data = system.alarm.queryJournal(state = state, provider = 'test')

for item in data:
	print(item.get('name'))
	print(item.get('ackTime')

```

I am trying to show Active Time, Inactive Time, Ack Time, Ack user, Ack Notes into the table.  
**for item.get('ActiveTime'), item.get('AckTime') returning value of item.get('EventTime')**

How to get those values, can someone guide.

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [November 19, 2024, 9:23pm UTC](https://forum.inductiveautomation.com/t/trouble-getting-alarm-journal-parameters-to-table/98769/2 "2024-11-19T21:23:55Z")

</div>

You will struggle to use `print()` in a useful way in Ignition scripting.  
Is there a reason you are not using the Alarm Journal Component?  
Your use case seems to be just listing Alarms from the Journal in a standard way?

---

<div class="post-metadata">

**Author:** ![Learner\_Ignition](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@Learner\_Ignition](https://forum.inductiveautomation.com/u/Learner_Ignition)\
**Post date:** [November 21, 2024, 4:30am UTC](https://forum.inductiveautomation.com/t/trouble-getting-alarm-journal-parameters-to-table/98769/3 "2024-11-21T04:30:41Z")

</div>

I am trying to get few of the data from alarm journal and merge it with my own alarm history table.  
is there a better way to achieve own alarm history tabl?

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [November 21, 2024, 4:40am UTC](https://forum.inductiveautomation.com/t/trouble-getting-alarm-journal-parameters-to-table/98769/4 "2024-11-21T04:40:22Z")

</div>

Can you show us where you are trying to put these values with this script?  
Also show us what you have tried and any errors you get?

---

<div class="post-metadata">

**Author:** ![Learner\_Ignition](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@Learner\_Ignition](https://forum.inductiveautomation.com/u/Learner_Ignition)\
**Post date:** [November 22, 2024, 9:12am UTC](https://forum.inductiveautomation.com/t/trouble-getting-alarm-journal-parameters-to-table/98769/5 "2024-11-22T09:12:29Z")

</div>

I was trying to create my own Alarm History table and get the dataset from above scripts.  
However it was working for queryStatus not for queryJournal.

As of now I have taken data from alarm\_events table and written a trigger to insert and update another table.

**but still I am not able to figure it out how to get the alarm associated data to my table.**

```python
results = system.db.runNamedQuery('getAlarmHistory')

columns = ['ActiveTime', 'InActiveTime', 'tag', 'alm', 'AcknowledgeTime', 'AckUser', 'AckNotes']

rows = []

def split_alarm_name(alarm_name):
	try:

		tag = alarm_name.split('/tag:')[1].split(':/alm:')[0]
		
		alm = alarm_name.split(':/alm:')[1]
		
		return tag, alm
	except IndexError:
		return None, None

for row in results:

	alarm_name = row['AlarmName']  

	tag, alm = split_alarm_name(alarm_name)

	dataset_row = [
		row['ActiveTime'],  
		row['InActiveTime'],  
		tag,  
		alm,  
		row['AcknowledgeTime'],
		row['AckUser'],
		row['AckNotes']
	]

	rows.append(dataset_row)

dataset = system.dataset.toDataSet(columns, rows)

return dataset

```
