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

David R Robison drrobison at openroadsconsulting.com
Tue Feb 19 07:33:52 EST 2013


Yes, I was just wondering if I could use a pattern binding variable 
instead of a pattern. I guess I cannot. David

David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: drrobison at openroadsconsulting.com
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/bookstore/bookdetail.php?PB_ISBN=9781597816526

On 2/19/2013 7:02 AM, Wolfgang Laun wrote:
> 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
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



This email communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.
If you are not the intended recipient, please delete this email immediately.




More information about the rules-users mailing list