[rules-users] Retrieve values from a Map
Manav
manav7574 at yahoo.com
Wed Aug 11 23:09:14 EDT 2010
Thanks a lot Edson . The below approach worked like a charrm :). I went with
the second approach
Client( languages.keySet contains "Japanese", $lang : language["Japanese"]
)
Regards,
Akash
________________________________
From: Edson Tirelli <tirelli at post.com>
To: Manav <manav7574 at yahoo.com>; Rules Users List <rules-users at lists.jboss.org>
Sent: Wed, August 11, 2010 7:46:40 PM
Subject: Re: [rules-users] Retrieve values from a Map
Did you tried this?
Client( $lang : language["Japanese"] != null )
This will bind $lang to the value associated with the key "Japanese" on the
"languages" map and at the same time check that the value is not null. If you
want to explicit test if there is a key "Japanese" in the map, then you can do:
Client( languages.keySet contains "Japanese", $lang : language["Japanese"]
)
Edson
2010/8/11 Manav <manav7574 at yahoo.com>
I am new to drools and currently using version 5.1 for my testing.
>
>I am facing an issue with retrieving a value from Map if a key is present
>
>In my drl if i do this
>
>$c : Client (language contains "Japanese" , lang : language ->
>(language.get("Japanese").equals("Expert")))
>
>it works ...but if i want to retrieve the value of the key i am not sure how to
>go about it . I tried various approaches but none of them worked
>
>
>i would like to do something like
>
>$c : Client (language contains "Japanese", $langValue :
>language.get("Japanese"))
>
>
>Can some one please guide me how to go about it .
>
>Regards,
>Manav
>
>
>
>
>
>_______________________________________________
>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/20100811/f3ab6d92/attachment.html
More information about the rules-users
mailing list