laune,
Unfortunately, the earlier test worked when I set the dialect to "java". It
does not work when it's set to "mvel".
When the rule is written as follows :
rule "Hello World"
dialect "mvel"
when
$cur : Message()
$others : ArrayList ( size > 0 ) from collect(Message( status ==
Message.HELLO ))
then
for ( int ctr = 0; ctr < $others.size(); ctr++ ) {
System.out.println("Got message : " + (Message) others.get(i));
}
end
I am now getting the following error :
Unable to Analyse Expression for ( int ctr = 0; ctr < $others.size();
ctr++ ) {
System.out.println("Got message : " + (Message) others.get(i));
} ;:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.$others()]
[Near : {... int ctr = 0; ctr < $others.size(); ctr++ ) { ....}]
^
[Line: 7, Column: 0] : [Rule name='Hello World']
java.lang.IllegalArgumentException: Could not parse knowledge.
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:50)
at com.sample.DroolsTest.main(DroolsTest.java:23)
It looks like for some reason, the parser is unable to decipher the $other.
Any insight into what could cause this ?
Thanks in advance,
Gurvinder
--
View this message in context:
http://drools.46999.n3.nabble.com/Drools-parser-error-accessing-ArrayList...
Sent from the Drools: User forum mailing list archive at
Nabble.com.