Why not assert all Products into WM as opposed to the array list?? If you insist on just the array list, something along these lines should do the trick<br><br>rule &quot;Find Product&quot;<br>    when <br>        <br>        $list : ArrayList()<br>
        Product(productType == &quot;foo&quot;) from $list<br>    then <br>...<br><br><br><div class="gmail_quote">2009/6/10 prasad raju sagi <span dir="ltr">&lt;<a href="mailto:prasadrajusagi@yahoo.com">prasadrajusagi@yahoo.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style="font-family: verdana,helvetica,sans-serif; font-size: 10pt;"><div></div>
<div>Hi ,</div>
<div> </div>
<div>I am trying to insert fact as arraylist  and then i wanted to get the objects from the arraylist based on some condition.</div>
<div> </div>
<div>like     Arryalist&lt;Product&gt; fact was inserted into working memory, I want to get some product from the arrylist based on condition ( productType==??).</div>
<div> </div>
<div>Is there any solution for this .</div>
<div><br> </div>Thanks<br>Prasad Raju Sagi<br>Mobile: 847-644-4103
<div><br></div>
<div style="font-size: 10pt; font-family: verdana,helvetica,sans-serif;"><br>
<div style="font-size: 13px; font-family: arial,helvetica,sans-serif;"><font size="2" face="Tahoma">
<hr size="1">
<b><span style="font-weight: bold;">From:</span></b> Greg Barton &lt;<a href="mailto:greg_barton@yahoo.com" target="_blank">greg_barton@yahoo.com</a>&gt;<br><b><span style="font-weight: bold;">To:</span></b> Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, June 10, 2009 3:25:39 PM<br><b><span style="font-weight: bold;">Subject:</span></b> RE: [rules-users] Constaint evaluation<br></font><br><br>Correct.  When there are no more instantiations (a rule plus a set of objects that match the rule&#39;s conditions) on the agenda, then rule firing ceases.  With version 5 of drools they added the ability to keep the session ready and available to react even when there are no instantiations on the agenda, but you must make a separate method call to do that. (StatefulSession.fireUntilHalt() instead of fireAllRules())<br>
<br>--- On Wed, 6/10/09, Malenfant, Andre &lt;<a href="mailto:andre.malenfant@cgi.com" target="_blank">andre.malenfant@cgi.com</a>&gt; wrote:<br><br>&gt; From: Malenfant, Andre &lt;<a href="mailto:andre.malenfant@cgi.com" target="_blank">andre.malenfant@cgi.com</a>&gt;<br>
&gt; Subject: RE: [rules-users] Constaint evaluation<br>&gt; To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br>&gt; Date: Wednesday, June 10, 2009, 2:55 PM<br>
&gt; Ok, so now I understand that the<br>&gt; &quot;immutable&quot; is really a concept but not necessarily<br>&gt; &quot;enforced&quot;. So, the rule conditions get evaluated each time<br>&gt; the working memory is updated (and not globals) and rules<br>
&gt; for which the conditions are true at each evaluation will<br>&gt; fire. The execution of the rules will end when there is no<br>&gt; more rules for which the conditions are true. Am I correct?<br>&gt; <br>&gt; Thanks<br>
&gt;
 <br>&gt; -----Original Message-----<br>&gt; From: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a><br>&gt; [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>]<br>
&gt; On Behalf Of Greg Barton<br>&gt; Sent: Wednesday, June 10, 2009 3:49 PM<br>&gt; To: Rules Users List<br>&gt; Subject: RE: [rules-users] Constaint evaluation<br>&gt; <br>&gt; <br>&gt; The ideas is that objects in working memory are those that<br>
&gt; meant to be tracked: their changes are made visible to the<br>&gt; rules via the insert/update/retract methods.  A global<br>&gt; is not in working memory, so it&#39;s changes cannot be<br>&gt; tracked.  You can change the contents of a global all<br>
&gt; day long and the rules would never be notified.<br>&gt; <br>&gt; It&#39;s a similar concept
 to threads and<br>&gt; synchronization.  You can have unsynchronized access to<br>&gt; member variables in a class when in a multithreaded<br>&gt; environment, but the results are unpredictable. <br>&gt; Likewise, you can use globals in conditions, and change the<br>
&gt; value of the global as you go, but the results are<br>&gt; unpredictable.  <br>&gt; <br>&gt; --- On Wed, 6/10/09, Malenfant, Andre &lt;<a href="mailto:andre.malenfant@cgi.com" target="_blank">andre.malenfant@cgi.com</a>&gt;<br>
&gt; wrote:<br>&gt; <br>&gt; &gt; From: Malenfant, Andre &lt;<a href="mailto:andre.malenfant@cgi.com" target="_blank">andre.malenfant@cgi.com</a>&gt;<br>&gt; &gt; Subject: RE: [rules-users] Constaint evaluation<br>&gt; &gt; To: &quot;Kris Verlaenen&quot; &lt;<a href="mailto:Kris.Verlaenen@cs.kuleuven.be" target="_blank">Kris.Verlaenen@cs.kuleuven.be</a>&gt;<br>
&gt; &gt; Cc:
 &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br>&gt; &gt; Date: Wednesday, June 10, 2009, 2:20 PM<br>&gt; &gt; Thanks Kris,<br>&gt; &gt; <br>
&gt; &gt; I will try with code constraints.<br>&gt; &gt; <br>&gt; &gt; But on the globals subject, I read in the<br>&gt; documentation<br>&gt; &gt; that one should not use a global in a rule. I have<br>&gt; trouble<br>&gt; &gt; understanding why. I don&#39;t think drools clones the<br>
&gt; global<br>&gt; &gt; object (might not be possible anyway). If my rule<br>&gt; &gt; consequences change the state of a global (this usage<br>&gt; is<br>&gt; &gt; considered valid as per the documentation as well)<br>&gt; then what<br>
&gt; &gt; is the harm of using it in a condition? I could<br>&gt; understand<br>&gt; &gt; with immutable objects like String but...<br>&gt; &gt; <br>&gt; &gt; I can change my code to insert that global
 in the<br>&gt; working<br>&gt; &gt; memory but I would like to understand why I should do<br>&gt; so...<br>&gt; &gt; And if I do and the state of that object is changed by<br>&gt; a<br>&gt; &gt; consequence of my rules, I have to call update? For<br>
&gt; the same<br>&gt; &gt; reason? I guess I am trying to understand the<br>&gt; underlying<br>&gt; &gt; mechanism.<br>&gt; &gt; <br>&gt; &gt; Thanks<br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; -----Original Message-----<br>
&gt; &gt; From: Kris Verlaenen [mailto:<a href="mailto:Kris.Verlaenen@cs.kuleuven.be" target="_blank">Kris.Verlaenen@cs.kuleuven.be</a>]<br>&gt; &gt; <br>&gt; &gt; Sent: Wednesday, June 10, 2009 11:38 AM<br>&gt; &gt; To: Rules Users List; Malenfant, Andre<br>
&gt; &gt; Cc: Rules Users List<br>&gt; &gt; Subject: Re: [rules-users] Constaint evaluation<br>&gt; &gt; <br>&gt; &gt; It depends on what type of constraint you are using.<br>&gt; &gt; <br>&gt; &gt; If you
 are using a rule constraint, that constraint<br>&gt; will be<br>&gt; &gt; evaluated<br>&gt; &gt; just the same as normal rules.  This means that the<br>&gt; &gt; constraints are<br>&gt; &gt; evaluated when data is inserted / updated /<br>
&gt; removed. <br>&gt; &gt; Note that, if you<br>&gt; &gt; want to make sure the engine is using up-to-date<br>&gt; &gt; information, you must<br>&gt; &gt; notify the engine (using update) when you change the<br>&gt; data<br>
&gt; &gt; in the working<br>&gt; &gt; memory.  Also note that globals are considered<br>&gt; &gt; immutable.  You should<br>&gt; &gt; never write rules that depend on the state of a global<br>&gt; and<br>&gt; &gt; where the<br>
&gt; &gt; global can be changed.<br>&gt; &gt; <br>&gt; &gt; If you are using code constraints, the constraint is<br>&gt; &gt; evaluated at the<br>&gt; &gt; point the code constraint is reached.<br>&gt; &gt; <br>&gt; &gt; Kris<br>
&gt; &gt; <br>&gt; &gt;
 Quoting &quot;Malenfant, Andre&quot; &lt;<a href="mailto:andre.malenfant@cgi.com" target="_blank">andre.malenfant@cgi.com</a>&gt;:<br>&gt; &gt; <br>&gt; &gt; &gt; I have some trouble understanding how conditions<br>&gt; and<br>
&gt; &gt; constraints are<br>&gt; &gt; &gt; evaluated:<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; I have a rule flow split node with constraints on<br>&gt; a<br>&gt; &gt; global object.<br>&gt; &gt; &gt; The split node always takes the same path like if<br>
&gt; the<br>&gt; &gt; constraints are<br>&gt; &gt; &gt; evaluated at the beginning of the execution of<br>&gt; the<br>&gt; &gt; process and not<br>&gt; &gt; &gt; when the process flow reaches that split node.<br>&gt; What I<br>
&gt; &gt; would expect is<br>&gt; &gt; &gt; that the split node constraints takes into<br>&gt; account the<br>&gt; &gt; state of the<br>&gt; &gt; &gt; global object as modified by previous rules in<br>&gt; the<br>&gt; &gt; flow.<br>
&gt; &gt; &gt;
 <br>&gt; &gt; &gt; Am I right to think that rules conditions and<br>&gt; split<br>&gt; &gt; nodes constraints<br>&gt; &gt; &gt; are evaluated only when inserting/updating<br>&gt; objects in<br>&gt; &gt; the working<br>&gt; &gt; &gt; memory? The documentation is not really useful<br>
&gt; (unless<br>&gt; &gt; I haven&#39;t<br>&gt; &gt; &gt; found the appropriate one).<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; Thanks<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; André<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; -----Original Message-----<br>
&gt; &gt; &gt; From: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a><br>&gt; &gt; &gt; [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>]<br>
&gt; &gt; On Behalf Of Malenfant,<br>&gt; &gt; &gt; Andre<br>&gt; &gt; &gt; Sent: Wednesday, June 10,
 2009 11:07 AM<br>&gt; &gt; &gt; To: Kris Verlaenen<br>&gt; &gt; &gt; Cc: Rules Users List<br>&gt; &gt; &gt; Subject: RE: [rules-users] Globals in ruleflow<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; Thanks for trying this for me...<br>
&gt; &gt; &gt; <br>&gt; &gt; &gt; As it turns out, while I was creating a test<br>&gt; sample<br>&gt; &gt; for you I<br>&gt; &gt; &gt; realized<br>&gt; &gt; &gt; that my ruleflow was not loading properly and I<br>&gt; forgot<br>
&gt; &gt; to check for<br>&gt; &gt; &gt; errors on the builder. Now it works.<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; Still, the behavior is strange. If my rule<br>&gt; doesn&#39;t<br>&gt; &gt; load and even<br>&gt; &gt; &gt; though<br>
&gt; &gt; &gt; my DRL loaded, my globals were not available.<br>&gt; Since<br>&gt; &gt; the DRL declared<br>&gt; &gt; &gt; the<br>&gt; &gt; &gt; same globals it should not have given me that<br>&gt; error.<br>&gt; &gt; &gt; <br>
&gt; &gt; &gt; Thanks<br>&gt; &gt; &gt; <br>&gt; &gt;
 &gt; -----Original Message-----<br>&gt; &gt; &gt; From: Kris Verlaenen [mailto:<a href="mailto:Kris.Verlaenen@cs.kuleuven.be" target="_blank">Kris.Verlaenen@cs.kuleuven.be</a>]<br>&gt; &gt; <br>&gt; &gt; &gt; Sent: Tuesday, June 09, 2009 5:51 PM<br>
&gt; &gt; &gt; To: Rules Users List; Malenfant, Andre<br>&gt; &gt; &gt; Cc: Rules Users List<br>&gt; &gt; &gt; Subject: Re: [rules-users] Globals in ruleflow<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; Andre,<br>&gt; &gt; &gt; <br>
&gt; &gt; &gt; There should be no problem in using the same<br>&gt; global in<br>&gt; &gt; both your<br>&gt; &gt; &gt; rules<br>&gt; &gt; &gt; and processes.<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; I have tried a simple example as you described<br>
&gt; but<br>&gt; &gt; have not been able<br>&gt; &gt; &gt; to<br>&gt; &gt; &gt; reproduce the problem.  Could you send me a<br>&gt; &gt; self-contained example<br>&gt; &gt; &gt; that<br>&gt; &gt; &gt; shows the
 issue?<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; Kris<br>&gt; &gt; &gt; <br>&gt; &gt; &gt; Quoting &quot;Malenfant, Andre&quot; &lt;<a href="mailto:andre.malenfant@cgi.com" target="_blank">andre.malenfant@cgi.com</a>&gt;:<br>
&gt; &gt; &gt; <br>&gt; &gt; &gt; &gt; I am experimenting with rule flows and I get<br>&gt; the<br>&gt; &gt; following error:<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; &gt; &gt; Unexpected global [myglobal]<br>&gt; &gt; &gt; &gt; <br>
&gt; &gt; &gt; &gt; When calling setGlobal on the session.<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; &gt; &gt; This code works without the workflow<br>&gt; (globals<br>&gt; &gt; declared in the drl)<br>&gt; &gt; &gt; &gt; but<br>
&gt; &gt; &gt; &gt; fails when I include the rule flow. I<br>&gt; declared<br>&gt; &gt; the same globals in<br>&gt; &gt; &gt; &gt; the<br>&gt; &gt; &gt; &gt; rule flow in the header section.<br>&gt; &gt; &gt; &gt; <br>&gt; &gt; &gt; &gt;<br>
&gt;
 _______________________________________________<br>&gt; &gt; &gt; &gt; rules-users mailing list<br>&gt; &gt; &gt; &gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>&gt; &gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt; &gt; &gt; &gt; <br>&gt; &gt; &gt; <br>&gt; &gt; &gt; <br>&gt; &gt; &gt; <br>&gt; &gt; &gt; <br>&gt; &gt; &gt; Disclaimer: <a href="http://www.kuleuven.be/cwis/email_disclaimer.htm" target="_blank">http://www.kuleuven.be/cwis/email_disclaimer.htm</a><br>
&gt; &gt; &gt; <br>&gt; &gt; &gt; _______________________________________________<br>&gt; &gt; &gt; rules-users mailing list<br>&gt; &gt; &gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
&gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>&gt; &gt; &gt; <br>&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; rules-users mailing list<br>&gt; &gt; &gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>&gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt; &gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; <br>&gt; &gt; Disclaimer: <a href="http://www.kuleuven.be/cwis/email_disclaimer.htm" target="_blank">http://www.kuleuven.be/cwis/email_disclaimer.htm</a><br>
&gt; &gt; <br>&gt; &gt; _______________________________________________<br>&gt; &gt; rules-users mailing list<br>&gt; &gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt; &gt; <br>&gt; <br>&gt; <br>&gt;       <br>&gt; <br>&gt; _______________________________________________<br>&gt; rules-users mailing list<br>&gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>&gt; <br>&gt; _______________________________________________<br>&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt; <br><br><br>      <br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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></div><br>

      </div><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>
<br></blockquote></div><br>