I am attempting to append the tag alarm state to the dataSet. However, I am encountering an error message 'com.inductiveautomation.ignition.common.alarming.AlarmStateTransition' object is not iterable
I have successfully read the alarm state of all the tags. I need to append their status to the Status column as per the attached image. Could someone kindly provide guidance on how to proceed?
Thank you
storeData = []
copyData = event.source.parent.getComponent('copyData').data
print copyData
for row in range(copyData.getRowCount()):
tagPath = copyData.getValueAt(row, "TagName")
configTagPath = tagPath+"/ATestMem/A/Alarms/Test Alarm A.EventState"
configValue=system.tag.readBlocking(configTagPath)
alarmstate = configValue[0].value
print alarmstate
headers = ['TagName', 'status']
testData = []
for row in range(copyData.getRowCount()):
testData.append([copyData.getValueAt(row, "TagName") for column in range(copyData.getColumnCount())])
event.source.parent.getComponent('storeData').data = system.dataset.toDataSet(headers, testData)
You can then bind the visibility property to an expression: len({Root Container.storeData.data}) > 0
tagPaths = [tagPath + "/ATestMem/A/Alarms/Test Alarm A.EventState" for tagPath in event.source.parent.getComponent('copyData').data.getColumnAsList(0)]
tagValues = [tag.value for tag in system.tag.readBlocking(tagPaths)]
event.source.parent.getComponent('storeData').data = system.dataset.toDataSet(['TagName','status'],[[tagPath,str(tagValue)] for tagPath,tagValue in zip(tagPaths,tagValues) if tagValue == 'Active'])
I have tried this code but it not fetching any data to power table.
tagPaths = [tagPath + "/ATestMem/A/Alarms/Test Alarm A.EventState" for tagPath in event.source.parent.getComponent('copyData').data.getColumnAsList(0)]
tagValues = [tag.value for tag in system.tag.readBlocking(tagPaths)]
event.source.parent.getComponent('storeData').data = system.dataset.toDataSet(['TagName','status'],[[tagPath,str(tagValue)] for tagPath,tagValue in zip(tagPaths,tagValues) if tagValue == 'Active'])
Therefore I removed the below condition then code fetches all the active and clear alarm state. But I am interested only to show active state.
if tagValue == 'Active'
if event.propertyName == 'name':
tagPaths = [tagPath + "/ATestMem/A/Alarms/Test Alarm A.EventState" for tagPath in event.source.parent.getComponent('copyData').data.getColumnAsList(0)]
tagValues = [tag.value for tag in system.tag.readBlocking(tagPaths)]
event.source.parent.getComponent('storeData').data = system.dataset.toDataSet(['TagName','status'],[[tagPath,str(tagValue)] for tagPath,tagValue in zip(tagPaths,tagValues)])