Extracting custom associated properties returns domain values

I’m currently attempting to extract the associated properties and values of active alarm objects without having to use regex.

The following code returns a list of objects containing the active properties.

[code]>>auAlarmList = system.alarm.queryStatus(status=[“ActiveUnacked”])

for x in auAlarmList:
adList = x.activeData
print adList
{label=My label text, name=Alarm, eventValue=false, myAssociatedProperty=myPropertyValue}

When I add the following I successfully get a list of lists with property names:

>>print adList.properties [label, name, eventValue, myAssociatedProperty]

However, when I add the following in an attempt to retrieve the value of the previously named properties, I get this:

>>print adList.values [com.inductiveautomation.ignition.common.config.PropertyValue@4222e0f5, com.inductiveautomation.ignition.common.config.PropertyValue@17c18633, ...]

What is returned here exatcly? I assume it’s something other than the associated values. Maybe the value of the actual property.

adList is some implementing class of PropertySet - so when you call values (which Jython knows means getValues() you’re getting a list of PropertyValues back - which themselves have a getValue() method.


print [propertyValue.value for propertyValue in adList.values]

Worked great. Thank you.

>>auAlarmList = system.alarm.queryStatus(status=["ActiveUnacked"])
>>for x in auAlarmList:
>>	adList = x.activeData
>>	adList.properties
>>	print [propertyValue.value for propertyValue in adList.values]
>>  # ap = associated property, av = associated value

[ap1, ap2, ap3...]
[u'av1', u'av2', u'av3'...]
1 Like