[rules-users] Collect Function

Ronald R. DiFrango ron.difrango at gmail.com
Mon Jan 14 11:39:42 EST 2008


I also realize although the logic is all backwards the using the forall
works as the following:

DetailLine(detailKeyRecNo:keyRecNo != null, lineNumber != null )
forall( RrHeader( keyRecNo != detailKeyRecNo ) )

Not sure which one is better performing or not though.

On Jan 14, 2008 11:37 AM, Ronald R. DiFrango <ron.difrango at gmail.com> wrote:

> Edson,
>
> Dulp...you just made me realize what the issue is.  Stupid Developer!
>
> Thanks!
>
> Ron
>
>
> On Jan 11, 2008 2:04 PM, Edson Tirelli <tirelli at post.com > wrote:
>
> >
> >    Ronald,
> >
> >    you are doing:
> >
> > ArrayList( size == 0 )
> >
> >    Am I missing anything?
> >
> >    []s
> >    Edson
> >
> > 2008/1/11, Ronald R. DiFrango < ron.difrango at gmail.com>:
> > >
> > > All,
> > >
> > > I have the following rule which uses the collect function:
> > >
> > > rule "Invalid RR Line"
> > >     salience 100
> > >
> > >     when
> > >         rrDetailLine : DetailLine(detailKeyRecNo:keyRecNo != null,
> > > lineNumber != null )
> > >         rrHeader : ArrayList( size == 0 ) from collect(RrHeader(
> > > keyRecNo != detailKeyRecNo ))
> > >     then
> > >         // logger.debug("Invalid RR Line: " + rrHeader.size());
> > >         logger.debug("Invalid RR Line: " + rrDetailLine.getKeyRecNo
> > > ());
> > >         logger.debug("Invalid RR Line: " + rrDetailLine.getLineNumber
> > > ());
> > >         drools.halt();
> > > end
> > >
> > > What I am seeing is that if I only have 1 RrHeader in working memory
> > > this rule fails.  Th reason I know that there is an RrHeader object is that
> > > I change the rule to the following:
> > >
> > > rule "Invalid RR Line"
> > >     salience 100
> > >
> > >     when
> > >         rrDetailLine : DetailLine(detailKeyRecNo:keyRecNo != null,
> > > lineNumber != null )
> > >         rrHeader : RrHeader( keyRecNo != detailKeyRecNo )
> > >     then
> > >         // logger.debug("Invalid RR Line: " + rrHeader.size());
> > >         logger.debug("Invalid RR Line: " + rrDetailLine.getKeyRecNo
> > > ());
> > >         logger.debug("Invalid RR Line: " + rrDetailLine.getLineNumber
> > > ());
> > >         drools.halt();
> > >
> > > end
> > >
> > > And it worked just fine.
> > >
> > > Thoughts?
> > >
> > > Ron
> > >
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> > >
> >
> >
> > --
> >   Edson Tirelli
> >   JBoss Drools Core Development
> >   Office: +55 11 3529-6000
> >   Mobile: +55 11 9287-5646
> >   JBoss, a division of Red Hat @ www.jboss.com
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080114/1c9c0122/attachment.html 


More information about the rules-users mailing list