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

Martin Minka martin.minka at gmail.com
Thu Nov 29 19:23:20 EST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121130/f134da1d/attachment.html 


More information about the rules-users mailing list