Thank you, Mark.

 

 

 

I guess I succeeded with your hint using following rule:

 

 

rule "Test some counting"

 

      no-loop true

 

      when

 

  &nb sp;         customer : Customer()

 

            $i : Number( intValue > 5 )

 

          from accumulate( $t : Ticket(status == "Escalate", customer == customer ), count( $t ))            

 

      then

 

     

 

     ;  System.out.println( "Num : " + $i + " " + customer );

 

           

 

end

 

 

This there any way to get access to the counted Tickets in the "then" part? Do I have to perfrom a query?

 

 

 

 

 

---- Mark wrote: ------ 

look at hte Shopping Example, I use sum() there, but the concept is the same:

rule "determine 10% discount if total purcahses is over 100"           
    no-loop true   
    when
  &n bsp;     $c : Customer()
        $i : Double(doubleValue  > 100) from accumulate ( Purchase( customer == $c, $price : product.price ),
                                                                    sum( $price ) )
    then
          $c.setDiscount( 10 );
        insertLogical( new Discount($c, 10) );   
end

Mark
tom@bergstein-soraic.de wrote:

Does anybody have a good example about using count()?

_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users