Display Low priority Alarm on power table through Python script

Hello Forum Members,

I would like to display only low priority alarms when they are active. My requirements are as follows: I need to implement this requirement for only a few tags.

  1. The power table will be invisible until the low alarm is active.

  2. The power table will be visible when the low priority alarm is active, and the background colour must be yellow.

  3. The power table will be placed on the overview screen. If I press the active alarm, it will take it to the respective screen where the alarm is active.

Your suggestions and feedback are greatly appreciated.

Thank you

If you're looking for someone to do the work for you, I'd recommend one of the many Ignition integrators on the IA website:
System Integrator Search | Find an Ignition Integrator

If you're asking for help with a project you're working on, it helps to add screenshots and code snippets of what you've tried already.
Wiki - how to post code on this forum - General Discussion - Inductive Automation Forum

Dear All,
I am encountering an issue while testing the following script:

a) I have a master tag list . I am attempting to move this list to another list called “final list” with an additional column named “Active.” The final header should be [‘TagName’, ‘Active’].
However, I am receiving an error message indicating that “IndexError: Row 0 does not have the same number of columns as the header list.”

b) I have successfully read the tag, but it only returns the value “BTestTempTag.” I am attempting to loop through all the tags and assign the alarm status to the “Active” column.

Any suggestion much appreciated.

Thanks in Advance


masterData = event.source.parent.getComponent('masterData').data	
testHeaders = ['TagName',  'Active']
testData = []
	
for row in xrange(masterData.rowCount):
		testData.append([masterData.getValueAt(row, column) for column in xrange(masterData.columnCount)])
		#testData.append([masterData.getValueAt(row, 0)]) #for column in xrange(masterData.columnCount)])
event.source.parent.getComponent('finalData').data =  system.dataset.toDataSet(testHeaders, testData)

tagPath = finalData.getValueAt(row, 0)
configTagPath = tagPath+"/ATestMem/A/Alarms/Test Alarm A.IsActive"
configValue=system.tag.readBlocking(configTagPath)
alarmstate = configValue[0].value
print alarmstate

Perhaps use system.alarm.queryStatus and filter based on a tag list?

Sure thing! I’ll give it a shot and see if I can figure out how to check the alarm query status.

thank you.

Careful with calling queryStatus from Vision though as it can cause client lag due to it running in the EDT and needing a response from the gateway. Even a few of these calls running in the client can cause operator hair loss or cracks to appear "mysteriously" in your client monitors

1 Like

Well, you can also run it not on the EDT, and then it is much less trouble.

2 Likes

With 8.3, hopefully you won't have to do anything yourself to get it :slight_smile:

1 Like

Hello!

I attempted to use the “system.alarm.queryStatus” function, but it returned all tags, including those from other sites. I do not want to disrupt the Gateway.

Therefore, I have written the following script, which is not working as expected. Could someone please check how to achieve this?

masterData = event.source.parent.getComponent('masterData').data
testData = []
finalHeaders = ['status' , 'TagName']


for row in xrange(masterData.rowCount):
		testData.append([masterData.getValueAt(row, column) for column in xrange(masterData.columnCount)])
		#print testData
		tagPath = masterData.getValueAt(row, 0)
		print tagPath
		configTagPath = tagPath+"/ATestMem/A/Alarms.ActiveUnackCount"
		print configTagPath
		configValue=system.tag.readBlocking(configTagPath)
		#print configValue
		alarmstate = configValue[0].value
		#print alarmstate
		
		mastertagPath = [(tagName) for tagName in tagPath[0:].split(',')]
		#print mastertagPath
		data = [[i, tagPath] for i, (tagPath) in enumerate(mastertagPath)]
		options = system.dataset.toDataSet(finalHeaders, data)
		event.source.parent.getComponent('finalData').data = options


Hello All,

I have successfully identified the tags with active alarms. I am currently attempting to retrieve data from the source table to Power table(finalData). My focus is on extracting the source and event time data. Is there a way to accomplish this one please?

Thank you.

state = ["ActiveUnacked", "ActiveAcked"]
source = ["*PLC1000*", "*PLC2000*", "*PLC3000*", "*PLC4000*", "*PLC5000*", "*PLC6000*"]
table = event.source.parent.getComponent("Table")
results = system.alarm.queryStatus(source = source, state = state) 
table.data = results.getDataset()
event.source.parent.getComponent('masterData').data= table.data