Here is how you can achieve this:
rule "Init"
salience 10
when
exists FactObject(condition != true)
then
insertLogical(new Stop())
end
rule "Your Business rule"
when
not Stop()
//some other conditions that you want to check
then
//action
end
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of ganesh.p
Sent: Tuesday, September 02, 2008 7:32 PM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Check the condition is TRUE during a period of
time
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-tim
e-tp19270862p19270862.html
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not intend to
waive confidentiality or privilege. Use of this email is prohibited when received in
error.