Can't convert Active, Unacknowledged to java.lang.String

I am getting this error when I try to get the value of current alarm status based on some filter using system.alarm.queryStatus function. Is there any way to convert Java string result into normal text/string?


Script Starts


props = [(“Group”, “=”, “Plant A”)]
state = [“ClearUnacked”, “ActiveUnacked”, “ActiveAcked”]
priority = [1,2,3,4]

lblState = “”
lblPriority = 0
numState = 0

c_alarms = system.alarm.queryStatus(any_properties = props, state = state,priority = ‘Critical’)
h_alarms = system.alarm.queryStatus(any_properties = props, state = state,priority = ‘High’)
m_alarms = system.alarm.queryStatus(any_properties = props, state = state,priority = ‘Medium’)
l_alarms = system.alarm.queryStatus(any_properties = props, state = state,priority = ‘Low’)

if len(m_alarms) > 0:
j=1
for m_alarm in m_alarms:
lblState = m_alarm.state
lblPriority = 2
break

event.source.parent.getComponent(‘lblState’).text = lblState
event.source.parent.getComponent(‘numlblPriority’).value = lblPriority


Script Ends


I am getting this error for lblState

Did you try to convert the AlarmState object to string str(malarm.state) as suggested by the Documentation

Hello Chi,
Thank you very much. It works now.

Also, you should put your code inside a preformatted text block so your code is readable