<br>On 4 July 2011 15:53, esstrata <span dir="ltr"><<a href="mailto:esstrata@yahoo.es">esstrata@yahoo.es</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I'm using Drools 5.1.1 in a JavaSE 6 project.<br>
<br>
I can't get running a rule where a value obtained from WM is check for<br>
existence as a key of a global Map.<br>
<br>
I have a map of the type ProductTextCode -> Product, where keys are String<br>
and values Product<br>
/global Map productMap/<br>
<br>
Then in a rule a I want a condition where each String in WM is tested<br>
against map keyset.<br>
/<br>
rule "Product ID not in products map"<br>
dialect "mvel"<br>
when<br>
$pid : String()<br>
=> Here goes the condition <=<br>
then<br>
System.out.println("Invalid product id: " + $pid)<br>
retract ($pid)<br>
end<br>
/<br>
<br>
So far I've tried with productMap.containsKey($pid)</blockquote><div><br>Did you enclose this in eval(...) ?<br>-W<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
but a get a MVEL error<br>
as it takes 'containsKey' as a property.<br>
<br>
Please help. Thank you.<br>
<br></blockquote></div>