I am incrementing the variable inside an clips object by some number on RHS.
The rule is working, but going into infinite loop.
I tried running it without modifying the variable inside the object, it is coming into RHS once, but with modification it is going into loop.
(defrule modify
"modify"
(step 0)
?EA <- (object (is-a ALERT)
(ID ?RID&:(or(eq ?ID "R") (eq ?RID "Q")))
(TIME ?T)
)
=>
(bind ?time (send ?EA get-TIME))
(bind ?newTime (+ 86399 ?time))
(send ?EA put-TIME ?newTime)
(log_info (str-cat "old time is " ?time ", new time is " ?newTime "event time is " (send ?EA get-TIME)))
)
I am expecting the log to be printed once even after modifying the content inside object.
Thanks.
Removing the Slot on the LHS which we are incrementing on RHS fixed this.
(defrule modify
"modify"
(step 0)
?EA <- (object (is-a ALERT)
(ID ?RID&:(or(eq ?ID "R") (eq ?RID "Q")))
)
=>
(bind ?time (send ?EA get-TIME))
(bind ?newTime (+ 86399 ?time))
(send ?EA put-TIME ?newTime)
(log_info (str-cat "old time is " ?time ", new time is " ?newTime "event time is " (send ?EA get-TIME)))
)
If we keep slot TIME in LHS, after the change/increment the rule is getting re-triggered, and it is going in loop.