Make counter an object<br><br>when<br>&nbsp;&nbsp;&nbsp; $counter : Counter(value &lt;= 100)<br>...<br><br><br><div class="gmail_quote">On Mon, Dec 8, 2008 at 5:05 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>
Hello,<br>
I would like to take 100 sampling facts for rule and persist it in the db<br>
and ignore other data.<br>
How Can I maintain the counter? as global variable? Please clarify with<br>
sample code.<br>
I tried following way and but it does not work as expected.<br>
<br>
Ex:<br>
global Integer counter;<br>
rule &quot;get sampling data&quot;<br>
 &nbsp; when fact : Foo(some condition) &amp;&amp; eval(counter &lt;= 100)<br>
 &nbsp; then<br>
 &nbsp; &nbsp;counter++<br>
 &nbsp; // do some condition<br>
end<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/having-counter-in-drl-tp20904469p20904469.html" target="_blank">http://www.nabble.com/having-counter-in-drl-tp20904469p20904469.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>