[rules-users] Drools firing wrong rules

Edson Tirelli ed.tirelli at gmail.com
Mon Jul 11 18:44:02 EDT 2011


   It is not possible to know, looking only at the screenshots that you
sent, what is the problem. Are the values null at the time you insert them
into the session? If you modify them after inserting them into the session,
are you properly notifying the engine?

   Edson


2011/7/11 pamerida <elpamm at hotmail.com>

> 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.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110711/0a140d3c/attachment.html 


More information about the rules-users mailing list