[rules-users] or condition - subrules

Greg Barton greg_barton at yahoo.com
Fri Jan 16 12:31:33 EST 2009


Since you're doing "or" between two different object types you can't combine it using "||".

"||" is used only inside one condition element, while "or" is between condition elements, and a condition element will only match one object type.  (I figure this is why multiple rules are generated with "or" because you can write expressions that potentially match objects of different type.)  

"||" can be used to create a disjunctive test on a single property:

CoApplicant( relationship == "S" || == "foo" )

It can also be used with multiple properties:

CoApplicant( relationship == "S" || otherProperty == "bar" )

But there's no way I know of to use "||" between types.

--- On Fri, 1/16/09, kfs2 at chryslerfinancial.com <kfs2 at chryslerfinancial.com> wrote:

> From: kfs2 at chryslerfinancial.com <kfs2 at chryslerfinancial.com>
> Subject: [rules-users] or condition - subrules
> To: rules-users at lists.jboss.org
> Date: Friday, January 16, 2009, 10:35 AM
> I understand that as this rule is written below it will be
> compiled into 2 
> subrules which both fire.  I searched the archives and
> found a post where 
> Mark Proctor suggested "Bind each pattern, and do the
> || field constraints 
> in an eval.". I'm new to Drools, can someone
> elaborate on how I would do 
> that with the rule below?
> 
> rule "Test" 
>         when 
>                 (CoApplicant( relationship == "S"
> ) or (Contract ( state 
> in ("CO", "IL"))))
>         then 
>         ...
> 
> Thanks
> 
> Kent _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


      



More information about the rules-users mailing list