[rules-users] having counter in drl

David Sinclair dsinclair at chariotsolutions.com
Tue Dec 9 08:52:53 EST 2008


Make counter an object

when
    $counter : Counter(value <= 100)
...


On Mon, Dec 8, 2008 at 5:05 PM, techy <techluver007 at gmail.com> wrote:

>
> Hello,
> I would like to take 100 sampling facts for rule and persist it in the db
> and ignore other data.
> How Can I maintain the counter? as global variable? Please clarify with
> sample code.
> I tried following way and but it does not work as expected.
>
> Ex:
> global Integer counter;
> rule "get sampling data"
>   when fact : Foo(some condition) && eval(counter <= 100)
>   then
>    counter++
>   // do some condition
> end
> --
> View this message in context:
> http://www.nabble.com/having-counter-in-drl-tp20904469p20904469.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081209/8c11c4f9/attachment.html 


More information about the rules-users mailing list