rule "Simple Rule"
dialect "mvel"
when
$record: Record(dataMap["abc"]=="123")
then
System.out.println($record.dataMap["abc"]);
end
I got Exception when loading this rule. dataMap is a map in class Record. It
seems $record.dataMap["abc"] doesn't work in "THEN". Does anyone
know why?
Unable to build expression for 'consequence': 1 '
System.out.println($record.dataMap["abc"]);
' : [Rule name='Simple Rule']
java.lang.IllegalArgumentException: Could not parse knowledge.
--
View this message in context:
http://drools.46999.n3.nabble.com/can-not-use-mvel-to-access-object-in-a-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
I am sorry for missing information in question. I am using Drools 5.1.
I find out the reason just now.
I added Generic on Map on the get method for dataMap and now it works.
public Map<String, Data> getDataMap() {
return dataMap;
}
Thank you for replying!
--
View this message in context:
http://drools.46999.n3.nabble.com/can-not-use-mvel-to-access-object-in-a-...
Sent from the Drools: User forum mailing list archive at Nabble.com.