As far as I can see there is nothing wrong with your first attempt.
I've attached a test file of your scenario. It works for me. Can you please test my file and create a test case that fails?

Best, 

On Thu, Dec 31, 2009 at 10:26 AM, orchid <maya.pollack@gmail.com> wrote:

Hi All,
I'm using Drools 5.x. I have the following class:
public class Machine{
  ...
  private List rules = new ArrayList();
  ...
}

The 'rules' list holds strings. I would like from my rule to check whether
that list contains the string "rule2".

I've tried doing this in the following ways, but get compilation error:

rule "rule1"
 when
   /*1st attempt:*/ $m:Machine(rules contains "rule2")
   /*2nd attempt:*/ $m:Machine(rules.contains("rule2") )
 then
   ...
What am I doing wrong?

Thanks in advance !!!

--
View this message in context: http://n3.nabble.com/How-to-check-an-array-field-from-LHS-of-a-rule-tp104523p104523.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti