[rules-users] How to check an array field from LHS of a rule

orchid maya.pollack at gmail.com
Thu Dec 31 08:26:04 EST 2009


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.



More information about the rules-users mailing list