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

Esteban Aliverti esteban.aliverti at gmail.com
Thu Dec 31 09:24:41 EST 2009


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 at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091231/c633db9f/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TmpTest.java
Type: text/x-java
Size: 3367 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20091231/c633db9f/attachment.bin 


More information about the rules-users mailing list