[rules-users] Using memberOf on inline mvel list was Re: Welcome to the "rules-users" mailing list

Edson Tirelli ed.tirelli at gmail.com
Thu Feb 25 19:49:35 EST 2010


   Did you tried:

props[“NAME”] in (“Fred”, “Wilma”, “Barney”)

   Or, if you are using the mvel dialect:

props[“NAME”] memberOf ( [“Fred”, “Wilma”, “Barney”] )

    Note the () around the mvel inline list, and don't forget to set the
mvel dialect for the rule in the second case.

    Edson



2010/2/21 <spamcontrol at mac.com>

> Apologies for the initial subject.  Changing to a more appropriate one.
>
>
> On Feb 21, 2010, at 2:26 PM, Adam Krieg wrote:
>
> > I’m new to Drools and having trouble accessing my Domain object which is
> basically a container around a map.
> >
> > class Person {
> >    Map props;
> >    public Map getProps();
> > …. Extra stuff
> > }
> >
> >
> > I want to create a rule that will match when Age is greater than 20 and
> name is one of “Fred”, “Barney”, or “Wilma”.  These  entries are stored in
> the Map props, so that to get age, you would call
> person.getProps().get(“AGE”)
> >
> >
> >
> > rule "My Rule"
> >                dialect "mvel"
> >                when
> >                                $person : Person(
> >                                    props[“AGE”] > 20,
> >                                    props[“NAME”] memberOf [“Fred”,
> “Wilma”, “Barney”]
> >                                )
> >                then
> >                                System.out.println("found match”+$person);
> >
> > End
> >
> > But I am running into a parsing error:
> > no viable alternative at input ')' in rule "My Rule" in pattern Person.
> >
> > The second condition seems to be the problem.  Can I check for membership
> inside a List I create inline in mvel?
> >
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100225/2b70e217/attachment.html 


More information about the rules-users mailing list