Assuming that the engine is handling one set of facts at a time, I would<br>use a single additional fact to collect all decisions. The details of this object<br>may vary (depending on whether you have a constant number of rules or<br>
not).<br><br>enum Decision { UNDEF, GRANTED, DEFERRED,... }<br>class Collector {<br>    Decision decision = Decision.UNDEF;<br>    Set&lt;String&gt; rules;<br>   //...<br>} <br><br>Here is a sample rule:<br><br>rule &quot;rule1&quot;<br>
when<br>    $d : Decision( rules not contains &quot;rule1&quot; )<br>     ....<br>then<br>   modify( $d ){<br>      addRule( &quot;rule1&quot; ),<br>      setDecision( maximumOf( $d.getDecision(), Decision.XYZ ) )<br>   }<br>
end<br><br>At the end, the decision object contains the final decision.<br><br>-W<br><br><div class="gmail_quote">On 5 August 2010 07:34, bbarani <span dir="ltr">&lt;<a href="mailto:bbarani@gmail.com">bbarani@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hi,<br>
<br>
We have multiple rules defined in Guvnor and we fire all the rules at a<br>
time. There is a decision object set for each rule and I am trying to figure<br>
out a way to aggregate the result using the prirority of the decision object<br>
(kind of logical AND / OR)<br>
<br>
For Ex: The priority of the decision would be set as below<br>
<br>
Priority:<br>
<br>
Priority3              Priority2                    Priority1     Exception on any rule<br>
Granted   Action not Supported  Denied          Deferred<br>
<br>
After the rules are fired (I am considering 4 rules here) the final decision<br>
should be as follows<br>
<br>
Sample Rule result:<br>
<br>
Rule    Rule1   Rule2   Rule3                                Rule4<br>
FinalDecison<br>
Decisions       Granted Granted Granted                            Deferred<br>
Deferred<br>
        Granted Granted Action Not Supported      Granted                       Action Not<br>
Supported<br>
        Granted Granted Denied                             Granted<br>
Denied<br>
        Granted Granted Granted                             Granted<br>
Granted<br>
<br>
<br>
Is there a way to acheive this using rule flow group / any other simple way?<br>
<br>
Thanks,<br>
Barani<br>
<font color="#888888"><br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/How-to-aggregate-decisions-of-multiple-rules-In-Guvnor-tp1025115p1025115.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/How-to-aggregate-decisions-of-multiple-rules-In-Guvnor-tp1025115p1025115.html</a><br>

Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>