Globals should not be used for storing information that needs to be updated.  From the documentation:
Globals are named objects that can be passed in to the rule engine; without needing to insert them. Most often these are used for static information, or services that are used in the RHS of a rule, or perhaps a means to return objects from the rule engine. If you use a global on the LHS of a rule, make sure it is immutable.
So changes to a global are not taking into account in the LHS of rules.
You should insert your TestValid object in your workingMemory and use conditions as
    TestValid ( hasErrors == true )
Once we have variable support, you will be able to do exactly what you are trying to do here by defining a testValid variable.
----- Original Message -----
From: Manukyan, Sergey
To: Rules Users List
Sent: Wednesday, September 19, 2007 3:00 PM
Subject: [rules-users] globals in rule flow's Split



When using globals in rule flow’s Split I ran into problem that changes to the global cannot be recognized by the split and it continues to route the same destination.


F.e. I have a Split with constrains. And a global TestValid object that has one boolean attribute - hasErrors


global testValid


Split :

-          eval(!testValid.isHasErrors())      // to No Errors action

-          eval(testValid.isHasErrors())       // to END



So it ends up with always looping to the No Errors Action, even though Make Errors sets global :  testValid.setHasErrors(true)


In my previous example the problem was that I was not using Shadow Proxy. But now I am and would like to use global in the split condition,


Please advice if it is an expected behavior and I shouldn’t be using global in split conditions…






This E-mail message and any attachments may contain
legally privileged, confidential or proprietary
information. If you are not the intended recipient(s),
or the employee or agent responsible for delivery of
this message to the intended recipient(s), you are
hereby notified that any dissemination, distribution
or copying of this E-mail message is strictly
prohibited. If you have received this message in
error, please immediately notify the sender and
delete this E-mail message from your computer.

rules-users mailing list