Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
I was recently asked how to create an Expression Rule that reacts to an Alarm. One technique is to use the GUI:
Some notes about that rule:
For more information about alarm types, and the variables, functions, and actions available for an expression rule, please fire up the expression rule editor, and then select the online help.
It's always better to manage your custom objects, expression rules, and so on using Axeda Artisan. Here's how that Expression Rule would look in an apc-metadata file:
<rule>
<name>Alarm_Associated_ExpressionRule</name>
<description>An expression rule associated with an alarm</description>
<enabled>true</enabled>
<applyToAll>true</applyToAll>
<type>Alarm</type>
<ifExpression><![CDATA[Alarm.name == "FooAlarm"]]></ifExpression>
<thenExpression><![CDATA[ExecuteCustomObject("ReactToFooAlarm")]]></thenExpression>
<elseExpression></elseExpression>
<consecutive>true</consecutive>
</rule>
You could also create this rule using the API via a custom object or REST services. You'd just send the information above to the appropriate properties.
The alarm does not have to react to a name. You could react to the value of a data item (assuming an alarm was generated). For example, you could change the ifExpression to, "Alarm.dataitem.foo.value > 30." NOTE - If you wanted to react to a data change, and there wasn't an alarm coming up, you'd use an Expression Rule of type, "Data," and test for a value of the changed data item that triggered the expression rule.