<div dir="ltr"><br> Ron, if your global is set before ***asserting facts**** to the working memory and not changed anymore, you can use it. <br> Also, make sure your array or whatever is an attribute of a class, and so has some semantic to it.<br>
<br> You can do things like this:<br><br>when<br> MyArrayContainer( $flags : flags )<br> Number( intValue >= SOME_GLOBAL_THRESHOLD ) from <br> accumulate( $f : Flag( value == SOME_GLOBAL_VALUE ) from $flags,<br>
count( $f ) )<br>then<br> // threshold met<br>end<br><br> Another options is just create a holder class for your globals and assert it as a fact instead of using globals:<br><br>when<br> MyParameters( $threshold : threshold, $value : value )<br>
MyArrayContainer( $flags : flags )<br>
Number( intValue >= $threshold ) from <br>
accumulate( $f : Flag( value == $flags ) from $flags,<br>
count( $f ) )<br>
then<br>
// threshold met<br>
end<br>
<br><br> Hope it helps,<br> Edson<br><br><br><div class="gmail_quote">2008/7/23 Ron Kneusel <<a href="mailto:oneelkruns@hotmail.com">oneelkruns@hotmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Mike,<br>
<br>
I think the collect will work, I'll have to look at it more closely because the ordering of elements in the array is significant so I'm not sure I can just break the elements up into facts and let collect group them however it will.<br>
<br>
As a follow up, while my solution of using a global in the LHS works, is the problem with changing the global simply that the engine will not see the changes? For my case, the global is set before the rules engine is called and it will not change while the engine runs.<br>
<br>
Ron<br>
<div class="Ih2E3d"><br>
Mike wrote:<br>
<br>
>Have a look at the "Alarms" example for "Collect" in the (4.0.5) manual.<br>
><br>
>This should give you a good starting point.<br>
><br>
>Cheers,<br>
><br>
>Mike<br>
<br>
</div>_________________________________________________________________<br>
With Windows Live for mobile, your contacts travel with you.<br>
<a href="http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_mobile_072008" target="_blank">http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_mobile_072008</a><br>
<div><div></div><div class="Wj3C7c">_______________________________________________<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>
</div>