1 Reply Latest reply on Aug 29, 2012 1:42 PM by mhamel

    ConditionGroup which AnalysisRule fired a notification


      Hi All,


      Looking an answer on my question, I could not.


      So, reading all active notificaitons I am able to read them one by one. Each of them has a group of rules that is also accessible programmatically.


      I need to find the rule among them that fired a notification. As on a picture below, I have 3 conditions in the group, the 3rd one actually is firing the Notification, but programmatically I cannt find it.


      When I trace it in debugger I see ConfigStrings of all rules but they are useless to find it.


      The "Code = 1" for the first rule also:


        conditionGroup.AnalysisRules[0].AnalysisRules[2].ConfigString          -     "Code=1;Name=OutsideControl;Priority=Normal"
        conditionGroup.AnalysisRules[1].AnalysisRules[2].ConfigString          -     "Code=12;Name=Instrument Error;Priority=High"
        conditionGroup.AnalysisRules[2].AnalysisRules[2].ConfigString          -     "Code=1;Name=OutsideControl;Priority=Normal"


      How can I check which rule triggers set the notification to Active state ?


      Please help, spent evening already investigating that.









        • Re: ConditionGroup which AnalysisRule fired a notification

          @Oleg: You can get the notification current configuration and process one rule after another to find which one corresponds to your current value. You will need to parse every AnalysisRule object to find: AnalysisRulePlugIn, TimeRulePlugIn, ConfigString, MapVariable objects/properties. The combination AnalysisRulePlugIn, MapVariable and ConfigString will tell you what expression is evaluated to trigger or not a notification.


          For example, if you find that the analysis rule is of type "Comparison"  the ConfigString property is set to "Operator=LessThan;TargetValue=10;TargetValueType=Numeric;Deadband=0;" and MapVariables 'Input' and 'Output' are set to "Temperature" and "8407373C-A66C-464D-A7DD-790D13D7BB1D", this means:


          - Expression to evaluate is Temperature < 10
          - There is no deadband in the evaluation of the expression
          - Return the result of this analysis to another analysis which name/guid is...


          You continue with the remaining analysis rules and deduct which one has fired the notification.


          This method is tedious and takes some resources to retrieve the information. This thread and this one show other solutions to that problem in simpler terms.