0

This is my code into an .rdl

rule "Fulfilment 24345"
when

$evPtr: LeftArmStretched($tsmp:time)

    eval((3>$tsmp)==true)
then
System.err.println("$tsmp=      "+$tsmp);

end


rule "set timestamp"

when
   $las:LeftArmStretched();
then
   System.out.println("//change timestamp!!");
   $las.setTime(6);
end

If I run my example, 1st and 2nd rules fire and print:

//change timestamp!!
$tsmp=         6

but if $tsmp=3 the rule1 does not fire!!!! (3>6 false!)

If I manually write eval((3>6)==true) into rule1, the rule1 doesn't correctly fire!

Neeku
  • 3,646
  • 8
  • 33
  • 43
padibro
  • 1,324
  • 10
  • 56
  • 95

1 Answers1

0

A change to a fact object must be announced to the Rule Engine, i.e., use

modify( $las ){
    setTime( 6 )
}

Also, do not rely on rule "set timestamp" being fired first. Use some additional constraint, or salience.

laune
  • 31,114
  • 3
  • 29
  • 42
  • ok but if I use modify into rule "set timestamp" I create a loop and again rule "set timestamp" fire! – padibro Jan 23 '14 at 14:01