Hello,
I'm using Drools 5.1.1 in a JavaSE 6 project.
I can't get running a rule where a value obtained from WM is check for
existence as a key of a global Map.
I have a map of the type ProductTextCode -> Product, where keys are String
and values Product
/global Map productMap/
Then in a rule a I want a condition where each String in WM is tested
against map keyset.
/
rule "Product ID not in products map"
dialect "mvel"
when
$pid : String()
=> Here goes the condition <=
then
System.out.println("Invalid product id: " + $pid)
retract ($pid)
end
/
So far I've tried with productMap.containsKey($pid)
Did you enclose this in eval(...) ?
-W
but a get a MVEL error
as it takes 'containsKey' as a property.
Please help. Thank you.