[rules-users] Drools firing wrong rules

pamerida elpamm at hotmail.com
Mon Jul 11 16:27:21 EDT 2011


Hi everyone,
I have a couple of rules, I just want to show a message when one of the
fields is null and heres my code:

21.	|	rule 'rule1'
22.	|	salience 9990
23.	|	when
24.	|	Cuscar(bgm.size > 0 && bgm[0].c1001== null );
25.	|	then
26.	|	logger.log("Rule 1 activated");
27.	|	
28.	|	end
29.	|	
30.	|	rule 'rule2'
31.	|	salience 9970
32.	|	when
33.	|	Cuscar(bgm.size > 0 && bgm[0].c1004== null );
34.	|	then
35.	|	logger.log("Rule 2 activated");
36.	|	
37.	|	end

And here's the result:

Scenario #1

http://drools.46999.n3.nabble.com/file/n3160376/debug2.jpg 
with this values when I call fire all rules I dont get any message (its ok
because none of the elements is null)

Scenario #2
http://drools.46999.n3.nabble.com/file/n3160376/debug1.jpg 

with this values when I call fire all rules both rules are fired so i get
both messages "Rule 1 activated" and "Rule 2 activated" (Incorrect - it
should only fire rule number 1 cause only the element c1001 is null)

Scenario #3
http://drools.46999.n3.nabble.com/file/n3160376/debug3.jpg 

with this values when I call fire all rules I dont get any message
(Incorrect - it should activate rule number 2)

This is my model:
http://drools.46999.n3.nabble.com/file/n3160376/rules-drools-model-1.0.0-SNAPSHOT-jar-with-dependencies.jar
rules-drools-model-1.0.0-SNAPSHOT-jar-with-dependencies.jar 

Can anybody help me please?, I dont know what am I doing wrong, thank you
very much :) ....



--
View this message in context: http://drools.46999.n3.nabble.com/Drools-firing-wrong-rules-tp3160376p3160376.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list