[rules-users] Accessing maps (hashmaps) keys and values in rules

Edson Tirelli tirelli at post.com
Thu Jul 19 12:42:56 EDT 2007


   Denis,

   If you are using latest build from trunk (I'm not sure it already works
in MR3), you can use a simplified MVEL syntax:

when
    Person( address["business"].phone == "99999999" )
then
    ...
end

   Although, the above will be converted into an inline-eval. Not as bad as
a top level eval, but still more costly then using regular fields.

   []s
   Edson

2007/7/19, Ryan, Dennis (Dennis) <dennisryan at avaya.com>:
>
>  We are using Maps (HashMaps) in our rules and the only way we have found
> to access keys and values in the Map in the "when" clauses is thru use on
> eval() which I know is a big no-no by rules purists. Is there a better way,
> maybe some shorthand I'm not familiar with to deal with Maps in the when
> clause?
>
>
>
> Thanks,
>
> Dennis
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  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/20070719/78dd1737/attachment.html 


More information about the rules-users mailing list