Where is 'system.alarm.queryStatus'

I’m attempting to run the following script:

results = system.alarm.queryStatus(source=["*HiAlarm*"])

but I get the following error:

AttributeError: ‘com.inductiveautomation.ignition.designer.gui.tool’ object has no attribute ‘queryStatus’

I ran the following code:

import system.alarm
print dir(system.alarm)

and the queryStatus was not an included method!

Bottom line is that I’m trying to derive a boolean result from a folder any time there are any alarms present in the tags inside that folder.

For what its work the documentation for Ignition 8 still has this as a part of the documentation in the scripting section.

1 Like

Why did you import system.alarm? There is no need to do that.

Could you share more of your code? The error you’ve shared leads me to believe that you’ve assigned a value to system.alarm.

With the following code I was able to get an error approximating your issue:

system = {}
system['alarm'] = system.gui
self.custom.result = system.alarm.queryStatus(source='[default]')

My error:

It would also help to know where you are trying to run this script. (ie. a Perspective button event, an SFC script block, a gateway startup script, etc.)

I am running the code in a project script.Also my list is different than the image from the reply above. There is no alarm.queryStatus

If you don’t have the Vision module installed this function is only available in the gateway scope.

So if I only have perspective then how can I run scripts in a global scope? I thought all scripts were project scoped but projects were inherited if set to do so. Also the docs for system.alarm.queryStatus says that is it available thru perspective.

“Global” isn’t a scope. Scope isn’t defined by where you wrote the code, it’s where you are executing the code from.

From the snippet of error message you posted I’d guess you were trying to run it from the designer script console or something.

This function is available for use in Perspective, but you have to actually execute from Perspective (which is gateway scoped). Put it on a Perspective button and press it.