[rules-users] memberOf in a eval statement (dialect mvel)

Edson Tirelli tirelli at post.com
Fri Dec 7 12:12:09 EST 2007


   Not sure why do you want to do that. Better would be to simply:

rule "Your 5 Rule"
        dialect "mvel"
        when
                 $l:ArrayList( this contains "test" )
        then
                #actions
                System.out.println("OK");
end

   If you want to do that inside an eval, MVEL does not have "memberOf"
operator, but it has "contains", so just write:

eval( $l contains "test" )

   []s
   Edson


2007/12/7, vdelbart <delbart.v at mipih.fr>:
>
>
> Hi,
>
> I want to use the keyword memberOf in an eval statement (with dialect =
> mvel).
>
> rule "Your 5 Rule"
>         dialect "mvel"
>         when
>                  $l:ArrayList()
>                  eval("test" memberOf $l)
>         then
>                 #actions
>                 System.out.println("OK");
> end
>
> but it doesn't work, and I don't understand the error :
> Caused by: java.lang.ClassCastException: java.lang.String
>         at
> org.drools.base.mvel.MVELEvalExpression.evaluate(MVELEvalExpression.java
> :36)
>         at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
>         ... 12 more
>
> Thanks for your help,
>
> V.
> --
> View this message in context:
> http://www.nabble.com/memberOf-in-a-eval-statement-%28dialect-mvel%29-tf4962683.html#a14214524
> Sent from the drools - user 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
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071207/d84c8087/attachment.html 


More information about the rules-users mailing list