[rules-users] how to write the rule to match the latest facts

Wolfgang Laun wolfgang.laun at gmail.com
Wed Jun 5 04:51:20 EDT 2013


You'll need an attribute that determines the order. If your facts are
events, there's the timestamp. Otherwise, add a counter.

   $latest: F( $c: counter )
   not F( counter > $c )

-W

On 05/06/2013, suntrian <suntrian at 126.com> wrote:
> i inserted several facts of one type into the workmemory , but i need just
> the latest one, how should i write the rule to match the latest fact
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/how-to-write-the-rule-to-match-the-latest-facts-tp4024131.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list