Thanks, I'll try using 3.1M1 version.<br><br>PS: I've sent the same question to the mailing list using the label [rule-users] in the mail object, sorry for the repetition :-)<br><br><div><span class="gmail_quote">2007/3/13, Edson Tirelli <
<a href="mailto:tirelli@post.com">tirelli@post.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br> Francesco,<br><br>
You need to be careful when doing that, if you are using 3.0.x version.<br> First thing is that both sides of your "or" must be perfectly<br>"balanced", i.e., the same classes in the same order. I didn't tried
<br>that, but I think it works if you simply declare your binding once:<br><br>rule "orCondition"<br> when<br> myObj : (MyObject(field1 == "a", $field2 : field2, $field3 :<br>field3) or MyObject(field1 == "b")) //correct column
<br> AnotherPattern( attr2 == $field2, attr3 == $field3 )<br> then<br> System.out.println("fields = "+ field2 + field3);<br>end<br><br> This is a workaround for the 3.0.x versions.Try it and let me know plz.
<br><br> In 3.1M1 and later, all this is fixed and the correct is to declare<br>the variable in all logical branches:<br><br>rule "orCondition"<br> when<br> myObj : (MyObject(field1 == "a", $field2 : field2, $field3 :
<br>field3) or MyObject(field1 == "b", $field2 : field2, $field3 :<br>field3)) //correct column<br> AnotherPattern( attr2 == $field2, attr3 == $field3 )<br> then<br> System.out.println("fields = "+ field2 + field3);
<br>end<br><br> []s<br> Edson<br><br><br>Francesco Campagnola wrote:<br><br>> Hi,<br>><br>> I'd like to write a rule that contains an OR condition in the LHS, to<br>> match the presence in the working memory of an object with particular
<br>> values of a specific field. In the rest of LHS, i need to bind other<br>> values of the specific object matched. Is there a particular sintax to<br>> use for the binding?<br>><br>> For example:<br>>
<br>> rule "orCondition"<br>> when<br>> myObj : (MyObject(field1 == "a") or MyObject(field1 ==<br>> "b")) //correct column<br>><br>> field2: myObj.getField2
() // how to correctly get<br>> field3: myObj.getField3() // those values?<br>> then<br>> System.out.println("fields = "+ field2 + field3);<br>><br>> Thanks in advance, FC.
<br>><br>>------------------------------------------------------------------------<br>><br>>_______________________________________________<br>>rules-users mailing list<br>><a href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br>><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>><br>><br><br><br>--<br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer
<br> Office: +55 11 3124-6000<br> Mobile: +55 11 9218-4151<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br><br><br>_______________________________________________<br>rules-users mailing list
<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div>
<br>