Please read *carefully* - see !!!!!! below.
And make sure to check whether a DRL compilation results in an error.
Do not continue with errors.
On 30/07/2012, zeeshan <zeeshan.spring(a)gmail.com> wrote:
Hi Laune !
I am using 5.4 version. When I tried ur second solution, it gives
*NullPointerException*.
> This works with 5.4.0 - notice the "no-loop true". $sum
has class
> Number, this needs intValue() (or whatever) to match the parameter
!!!!!!!^^^^^^^^^^^^^^^^^^^^!!!!!!!
> type of the setter.
>
> rule "accumulate Policy values into Agent"
> no-loop true
> when
> $a: Agent( $id: id )
> accumulate( Policy( agentId == $id, $v: value ); $sum: sum( $v ) )
> then
> modify( $a ){ setValue( $sum.intValue() ) }
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!^^^^^^^^^^^^^^^^^^^^!!!!
> System.out.println( $a.toString() );
> end
>
>