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