Actually it is a event from an application usecase Thanks for your reply and I think I am very close with your help. This rule is giving error Line 99:5 mismatched input 'or' in rule "usecase-test"] rule "usecase-test" when $e0 : Event () ParsedValue(event == $e0, ruleId == "0", varName == "V0_1", $e0_V0_1_varStringValue : varStringValue) ParsedValue(event == $e0, ruleId == "0", varName == "V0_2", $e0_V0_2_varStringValue : varStringValue) accumulate( ParsedValue( ruleId == "0", varName == "V0_1", varStringValue == $e0_V0_1_varStringValue, $e : event ) and ParsedValue( event == $e, ruleId == "0", varName == "V0_2", varStringValue == $e0_V0_2_varStringValue ) and ( ( ParsedValue( event == $e, ruleId == "1", varName == "V1_1", varStringValue == "X1_1") and ParsedValue( event == $e, ruleId == "1", varName == "V1_2", varStringValue == "X1_2") ) or [< ( ParsedValue( event == $e, ruleId == "2", varName == "V2_1", varStringValue == "X2_1") and ParsedValue( event == $e, ruleId == "2", varName == "V2_2", varStringValue == "X2_2") ) ); $es: collectSet( $e ); $es.size() >= 5 ) then System.out.println( "usecase-test" + $es.size()); end The Event comes from application and is parsed for values. The event from same application will have the same values for ruleId=0, varName-V0_1 and V0_2 So any event with same values for V0_1 and V0_2 is coming from same application. The rule says if from same application you have values which has this combination ruleId == "1", varName == "V1_1", varStringValue == "X1_1" ruleId == "1", varName == "V1_2", varStringValue == "X1_2" or this combination ruleId == "2", varName == "V2_1", varStringValue == "X2_1" ruleId == "2", varName == "V2_2", varStringValue == "X2_2" or this combination say ruleId == "3", varName == "V3_1", varStringValue == "X3_1" ruleId == "3", varName == "V3_2", varStringValue == "X3_2" ruleId == "3", varName == "V3_3", varStringValue == "X3_3" In pure english it is First I have to identify if I am dealing with events from same application This is by comparing (2) parsed values V0_1 and V0_2. If they are same across events .. then it having same source. Next lets check for other conditions.. >From Rule 1.. I want to check values of V1_1 and V1_2, if there is a issue >From Rule 2.. I want to check values of V2_1 and V2_2, if there is a issue Now I do not want to raise exception as soon as condition is met.. since the problem can occur and can be ignored. But if it happens more than 5 times from the same source, then I want to raise an alert.

View this message in context: Re: Nested Collect probably
Sent from the Drools: User forum mailing list archive at Nabble.com.