I bet this : your error list is the same instance, shared in all Party objects...
Am I right ?
And why do you need to pass "drools" to your "appendMessage" method ?
Do you modify (insert/update/retract some objects) the WM inside this method ? Be very
careful if you do that (especially if you said you are new to drools), it could leads to
some number of hours wondering why this rule is looping, not trigering .... Better (IMO)
is to use update/retract/insert only in rules.
----- Mail original -----
De: "freejava" <freejava3(a)gmail.com>
À: rules-users(a)lists.jboss.org
Envoyé: Mercredi 21 Décembre 2011 18:53:23
Objet: Re: [rules-users] Rules Hello Evalution
Thanks for the explanation. I think I got it.
Here is my scenario: I have n number of parties in the memory. I have to
perform the validation on each party for the party type. If it fails then
add an error message(just one) to the collection of that particular party.
So I rewrote the rule as below
rule "041"
when
Party(partyType != null, partyType.trim() != "",
partyType not in ("MF", "SE", "BY",
"ST", "LG",
"CS", "CN"), $e : dentificationGrp.errors)
then
appendMessage($e, drools)
end
Now I have two objects :
p1 : Party(partyType=*"SE *", List<String> errors) and p2 :
Party(partyType=*"CS "* ,List<String> errors);
After consequence is fired both p1 and p2 has 2 error message of type "041".
where as the expected result should be 1 error message for p1 and p2. How
can I acheive that ?
--
View this message in context:
http://drools.46999.n3.nabble.com/Rules-Evalution-tp3602504p3604691.html
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users