[rules-users] Trouble using || operator and after evaluator in constraints in 5.4.0.Final

Wolfgang Laun wolfgang.laun at gmail.com
Thu Aug 16 09:08:22 EDT 2012


This is a bug.

Note that the equivalent rule
package datelist;

rule "Sample rule"
when
    CurrentDate( $now: now )
    $obj: MyObject( ## $obj memberOf $list,
                    myDate == null || myDate after[5d] $now )
    MyObjectList( $list: myObjectList contains $obj )
then
    System.out.println( "Sample rule activated" );
end

compiles correctly, and so it isn't the "||" alone that causes the
problem; it's the combination of
   $obj /* this */ memberOf $list, myDate == null || myDate after[5d] $now

-W

On 16/08/2012, abr <alexis.brouard at haulogy.net> wrote:
> Oops!
> This is a typo when creating the example I mentioned in my previous
> message.
>
> Here is the correct rule syntax (the $list variable is bound from
> MyObjectList.myObjectList, which is of type java.util.List):
>
> rule "Sample rule"
>     when
>     	CurrentDate( $now: now )
>         MyObjectList( $list: myObjectList )
>         $obj: MyObject(
>         		this memberOf $list,
>         		( myDate == null ||
>         		  myDate after[ 5d ] $now ) )
>     then
>         System.out.println( "Sample rule activated" );
> end
>
> Sorry about the confusion.
>
> Best,
> Alexis
>
> Side note: you mentioned 5.4.0 has more strict compile checks but, I've
> tried to enter the incorrect syntax in another project (aka something like
> "this memberOf $variable" where $variable is not (or does not inherit from)
> a Collection or array) and compilation ended successfully.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Trouble-using-operator-and-after-evaluator-in-constraints-in-5-4-0-Final-tp4019181p4019186.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
>


More information about the rules-users mailing list