[rules-users] keep only one, retract all other

Martin Minka martin.minka at gmail.com
Fri Nov 30 02:01:02 EST 2012


Thank you for the tip. What solution would you suggest to solve my problem ?

Martin


2012/11/30 Wolfgang Laun <wolfgang.laun at gmail.com>

> You cannot use an interfact (List) to instantiate an object, which
> is happening due to the collect.
> --W
>
> On 30/11/2012, Martin Minka <martin.minka at gmail.com> wrote:
> > I want to keep only 1 fact with id=="aaaa". But this is not working:
> >
> > rule "leave only one"
> > when
> >     $removeUs : java.util.List(size>1)
> >         from collect(Fact(id=="aaaa")
> > then
> >     size = $removeUs.size();
> >     for (int i=1; i < size; i++) {
> >         retract($removeUs.get(i));
> >     }
> > end
> >
> _______________________________________________
> 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/20121130/5cbde7f9/attachment.html 


More information about the rules-users mailing list