Pattern matching is driven by working memory (fact) changes. A rule
that tries to match only a global variable will not be notified when
that variable changes; the patterns will only be evaluated when facts
matched by the rule change. If the rule matches no facts, then it's
evaluated when (reset) is called, and never again.
Instead of using a defglobal, use a fact; use modify to increment a
slot value in the rule, and use a no-loop declaration to prevent an
endless loop.
On Feb 27, 2008, at 5:51 PM, Nara Hari wrote:
Hi,
We process a set of records through the rule engine and we would
like to
know the number of records processed and if it exceeds certain
number we
would like to do some special handling.
We defined a global variable, and we incremented it in an ‘always
true'
rule. But the next rule where we check the global-variable, it
still refers
to the old value and never gets fired.
Is there something special handling we should keep in mind for the
global
variables?
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------