[rules-users] Conditions on the accumulation function

Wolfgang Laun wolfgang.laun at gmail.com
Thu Aug 23 02:55:35 EDT 2012


See below.

On 23/08/2012, senyatur <senya.touretski at emc.com> wrote:
> Hi everyone
> We are having rules using drools fusion, sliding windows and accumulation
> functions.
> Example:
> when
>    Number($count1 : longValue , longValue >= $parameter) from accumulate(
> TestingClass($status : status , a=5, b=6) over window:length( 7 ) from
> entry-point "EntryPoint" , count($status) )
> then
>    // some java code...
>
> What happens is that only objects of type TestingClass with a=5 and b=6 are
> inserted into the window.
> What we are trying to achieve is count how many TestingClass objects of
> *any
> last 7* TestingClass objects meet the condition (a=5,b=6).
> This obviously isn't met because the window contains only objects meeting
> the condition.
> Is there a way to put a condition on the *count* function and not on
> *window*?

Not quite, since you'll have to add, not count.

 ... , $a: a, $b: b) .., sum($a==5 && $b ==6 ? 1 : 0) )

-W



> Thanks!
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Conditions-on-the-accumulation-function-tp4019350.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