[rules-users] Check the condition is TRUE during a period of time

ganesh.p ganesh_patkar at hotmail.com
Tue Sep 2 10:02:05 EDT 2008


Hi All,

I want to write a rule which should fire only when the condition is true for
all the facts asserted during a period of time.

E.g.: 

rule "rule1" duration 30000
when TxInfo(txTime > 100)  // for 30 seconds
then
//some action
end


I tried using "duration" attribute, but once the rule is activated, it fires
rule when the last fact match the condition during the 30 seconds duration. 
It looks like, once the first fact matches the condition then it starts a 30
seconds timer, once the 30 seconds complete if the last fact match the
condition then it fires the rule. It ignores the intermediate facts during
the 30 seconds duration.

Suppose the facts(TxInfo.txTime) are

20, 40, 105[Activation], 115, 120, 4, 110[Last fact matches the condition,
so fires the rule]
20, 40, 105[Activation], 115, 120, 110, 4[Last fact doesn't match the
condition, so doesn't fire the rule]

I want the rule shouldn't fire in the both the above cases. 
How can we check the condition is TRUE for 30 seconds duration for all the
facts asserted during this time?

Thanks in advance,
Ganesh
-- 
View this message in context: http://www.nabble.com/Check-the-condition-is-TRUE-during-a-period-of-time-tp19270862p19270862.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list