# Creating a system.dataset in a Gateway Tag Change script

**URL:** <https://forum.inductiveautomation.com/t/creating-a-system-dataset-in-a-gateway-tag-change-script/9756>\
**Category:** Ignition\
**Created:** [February 27, 2015, 6:02pm UTC](https://forum.inductiveautomation.com/t/creating-a-system-dataset-in-a-gateway-tag-change-script/9756 "2015-02-27T18:02:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [February 27, 2015, 6:02pm UTC](https://forum.inductiveautomation.com/t/creating-a-system-dataset-in-a-gateway-tag-change-script/9756/1 "2015-02-27T18:02:15Z")

</div>

I have been trying to get alarm areas from the system.alarm.queryStatus script. I have it working with a button on a screen with a custom property dataset and a integer with the following code.

ds = event.source.parent.getComponent(‘Tabs’).Dataset  
results = system.alarm.queryStatus(Source=[“_Loadout_”], State=[“ActiveUnacked”])  
ds = results.getDataset()  
event.source.parent.getComponent(‘Tabs’).LoadoutAlmActive = ds.rowCount

but I really need it to work whenever there is a new alarm in the system to check for any new alarms in this “area” of my tag folder structure. So I thought the best place for that would be a GateWay Event Tag change script looking at “[System]Gateway/Alarming/Active and Unacked” to run the following script, but I am having problems getting the queryStatus script into a dataset that is not a custom property dataset. What would be the best way to do this?

results = system.alarm.queryStatus(Source=[“_Loadout_”], State=[“ActiveUnacked”])  
ds = system.dataset.toDataSet(results)

system.tag.write(test,ds.rowCount)

Thanks for any input.

---

<div class="post-metadata">

**Author:** ![DSI600](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@DSI600](https://forum.inductiveautomation.com/u/DSI600)\
**Post date:** [February 27, 2015, 8:04pm UTC](https://forum.inductiveautomation.com/t/creating-a-system-dataset-in-a-gateway-tag-change-script/9756/2 "2015-02-27T20:04:20Z")

</div>

I ended up figuring it out. Below was the code I used if anyone was interested.

system.tag.writeToTag(‘test’,0)

results = system.alarm.queryStatus(Source=[“_Loadout_”], State=[“ActiveUnacked”])  
ds = results.getDataset()

for row in range(ds.rowCount):  
for col in range(ds.columnCount):  
system.tag.writeToTag(‘test’,ds.rowCount)
