[rules-users] Can I check if a collection contains one of another collection

David Sinclair dsinclair at chariotsolutions.com
Tue May 5 08:54:09 EDT 2009


I am not sure exactly what you are trying to express with your example, but
more likely than not, you'll be able to do what you are trying through the
collect conditional element.

Something along the lines of this?

when
    a: Answer($responses : responses)
    java.util.ArrayList( size > 1 ) from collect (String(this == "a" || ==
"b" || == "c") from $responses)
then
    System.out.println("Cannot have more than one response!");

On Fri, Aug 22, 2008 at 4:18 PM, David Cracauer <dcracauer at earthlink.net>wrote:

>
> Hi,
> I'm getting stuck on this and I'm hoping someone can help..
> I need to be able to check that a collection contains one, and only one
> item
> from another collection.
>
> Ideally, I would do something like this:
>
>  a:Answer(responses contains one of ("a","b","c"));
>
> Is there a way do do this without resorting to evals or predicate
> expressions? (drools 4.07)
>
> Thanks,
> Dave
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Can-I-check-if-a-collection-contains-one-of-another-collection-tp19114896p19114896.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090505/c5521b8b/attachment.html 


More information about the rules-users mailing list