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@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@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