Use some ordered collection, like a TreeSet. It will order them for u<br><br><div class="gmail_quote">On Tue, Feb 17, 2009 at 4:35 PM, techy <span dir="ltr">&lt;<a href="mailto:techluver007@gmail.com">techluver007@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>
That&#39;s makes Edson. Thank you.<br>
<br>
Is there way to to sort the facts collected using &quot;collect&quot; in LHS itself? I<br>
could not find any hint in the documentation.<br>
<br>
<br>
<br>
Edson Tirelli-3 wrote:<br>
&gt;<br>
&gt; &nbsp; &nbsp;That is expected behavior.<br>
&gt;<br>
&gt; &nbsp; &nbsp;This is because quantifier CEs like &quot;exists&quot;, &quot;not&quot; and &quot;forall&quot; will<br>
&gt; evaluate multiple facts at once. So, if your rule has 5 foos in the<br>
&gt; working<br>
&gt; memory, which one would you expect to print?<br>
&gt;<br>
&gt; &nbsp; &nbsp;If you want to print each of them, remove the &quot;exists&quot;... if you want<br>
&gt; to<br>
&gt; print all of them, use &quot;collect&quot; instead of &quot;exists&quot;.<br>
&gt;<br>
&gt; &nbsp; &nbsp;[]s<br>
&gt; &nbsp; &nbsp;Edson<br>
&gt;<br>
&gt; 2009/2/17 techy &lt;<a href="mailto:techluver007@gmail.com">techluver007@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; I get $foo can&#39;t be resolved error for following rule. Some guidance is<br>
&gt;&gt; appreciated to reference $foo without error.<br>
&gt;&gt;<br>
&gt;&gt; Rule &quot;Foo rule&quot;<br>
&gt;&gt; when<br>
&gt;&gt; &nbsp; exists( $foo: Foo())<br>
&gt;&gt; then<br>
&gt;&gt; &nbsp;System.out.println($foo);<br>
&gt;&gt; end<br>
&gt;&gt;<br>
&gt;&gt; Thanks in advance.<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://www.nabble.com/error-when-referening-LHS-%3Eexists-block-var-in-RHS-tp22063253p22063253.html" target="_blank">http://www.nabble.com/error-when-referening-LHS-%3Eexists-block-var-in-RHS-tp22063253p22063253.html</a><br>

&gt;&gt; Sent from the drools - user mailing list archive at Nabble.com.<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">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; &nbsp;Edson Tirelli<br>
&gt; &nbsp;JBoss Drools Core Development<br>
&gt; &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">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>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://www.nabble.com/error-when-referening-LHS-%3Eexists-block-var-in-RHS-tp22063253p22066856.html" target="_blank">http://www.nabble.com/error-when-referening-LHS-%3Eexists-block-var-in-RHS-tp22063253p22066856.html</a><br>

Sent from the drools - user mailing list archive at Nabble.com.<br>
<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>