Thanks, I'll try using 3.1M1 version.

PS: I've sent the same question to the mailing list using the label [rule-users] in the mail object, sorry for the repetition :-)

2007/3/13, Edson Tirelli < tirelli@post.com>:

    Francesco,

    You need to be careful when doing that, if you are using 3.0.x version.
    First thing is that both sides of your "or" must be perfectly
"balanced", i.e., the same classes in the same order. I didn't tried
that, but I think it works if you simply declare your binding once:

rule "orCondition"
    when
        myObj : (MyObject(field1 == "a", $field2 : field2, $field3 :
field3) or MyObject(field1 == "b"))    //correct column
        AnotherPattern( attr2 == $field2, attr3 == $field3 )
    then
        System.out.println("fields = "+ field2 + field3);
end

    This is a workaround for the 3.0.x versions.Try it and let me know plz.

    In 3.1M1 and later, all this is fixed and the correct is to declare
the variable in all logical branches:

rule "orCondition"
    when
        myObj : (MyObject(field1 == "a", $field2 : field2, $field3 :
field3) or MyObject(field1 == "b", $field2 : field2, $field3 :
field3))    //correct column
        AnotherPattern( attr2 == $field2, attr3 == $field3 )
    then
        System.out.println("fields = "+ field2 + field3);
end

   []s
   Edson


Francesco Campagnola wrote:

> Hi,
>
> I'd like to write a rule that contains an OR condition in the LHS, to
> match the presence in the working memory of an object with particular
> values of a specific field.  In the rest of LHS, i need to bind other
> values of the specific object matched. Is there a particular sintax to
> use for the binding?
>
> For example:
>
> rule "orCondition"
>     when
>         myObj : (MyObject(field1 == "a") or MyObject(field1 ==
> "b"))    //correct column
>
>         field2: myObj.getField2 ()    // how to correctly get
>         field3: myObj.getField3()    // those values?
>     then
>         System.out.println("fields = "+ field2 + field3);
>
> Thanks in advance, FC.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
> rules-users@lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>
>


--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users