[rules-users] Using global variable in DRL file

Wolfgang Laun wolfgang.laun at gmail.com
Mon Jul 30 04:00:43 EDT 2012


Could you please post the exact code of your rule with solution #2 and
the NPE stack trace? You're using Drools 5.4.0?

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



On 30/07/2012, zeeshan <zeeshan.spring at gmail.com> wrote:
> HI Laune,
>
> Thanks for ur solutions, first one working fine but* we want agentAPE value
> for other rules or atleast we want them on RuleMain.java*(where we create
> agent csv bean objects).
>
> Your second solution when we implemented was throwing NULL Pointer
> Exception.
>
> Laune can u suggest us way in which we can solve problem related to first
> solution
> and if possible can we move with second one.
>
>
> Thanks....
>
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018958.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