it's not just enough to update the field,. you must also call update( object ).
update($dayInWeek)

Mark

Martin Book wrote:

Hello,

 

i am a newbie at JBoss Rules and have a problem with a ruleset. Here are my rules:

 

rule "1.CallsPerDay"  à Modifies the “CallsPerDayOfWeek” objects.

      salience 35

      when

            $dayObj: CallsPerDay( $day: dayOfWeekS != null, $calls:calls > 0 )

            $dayInWeek: CallsPerDayOfWeek( day == $day )

      then

            $dayInWeek.addCalls($calls);       à Changes call variable.

            System.out.println("Drools: "+$dayObj.getInfo()+" / "+$dayInWeek.getCalls());

      End

 

//Output: Drools: On Mo 02/19/2007 12:00:00 AM 97 calls came in. / 104

     

rule "2.ProcessAgents" -> Should only process on changed “CallsPerDayOfWeek” objects (calls must be 104 but seem to be still 0)

      salience 35

      when

            $dayInWeek:CallsPerDayOfWeek ($callsTMP: calls==0, sum == 0)

      then

            System.out.println("Sum = "+$dayInWeek.getSum()+" for "+$dayInWeek.getDay()+" CallTMP: "+$callsTMP+" /CallReally: "+$dayInWeek.getCalls());

      end

 

//Output= Sum = 2 for Mo CallTMP: 0 /CallReally: 104

 

Why is the “calls” variable still 0 at the beginning of rule "2.ProcessAgents", although it was modified by the rule "1.CallsPerDay"?

 

with kind regards

 

Martin

 


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