[rules-users] Testing the count of a pattern binding variable

Wolfgang Laun wolfgang.laun at gmail.com
Tue Feb 19 07:02:48 EST 2013


There's a minor problem with the syntax

On 19/02/2013, Stephen Masters <stephen.masters at me.com> wrote:
> Assuming that you don't have an infinite variety of accumulations you're
> trying to use, something I have done previously is to create DRL technical
> rule to generate accumulated values, which the DSL then uses as
> constraints.
>
> i.e.
>
> rule "Generate sensor counts"
> when
> 	$sensor : Sensor()
> 	accumulate($sensor; $count:count(1); $count >3)

    // need a Pattern up front, not a binding variable
    accumulate( Sensor();  $count:count(1); $count >3)

> then
> 	insert(new SensorCount($count));

   // it might be necessary to write
   insert( new SensorCount( $count.intValue() ) );

What was the original problem? ;-)
-W


More information about the rules-users mailing list