What about:

Number( intValue > 1 ) from accumulate(
        LabEvent( eval( dateWithinLastMonths(effectiveTime,1)), results : laboratoryResult ) and
        LabResult( value > 1.8 ) from results,
        count( 1 ) )

   Accumulate supports multiple patterns and has the count() function.

   Try it out and let us know.


2008/7/29 Yoni Mazar <y.mazar@gmail.com>

Hi all,

Our object deals with the clinical domain. We have a class LabEvent that
represents a visit in the laboratory. Each event is associated (using the
laboratoryResult association) with one or more LabResult objects (children),
each represents the results of a particular test.
in the rule LHS we want to express the following condition:
"At least two LabEvents in the last month, with a LabResult with value
greater than 1.8"
of note, the application asserts the LabEvent objects to the workingMemory.

in DRL we tried to write it as:
ArrayList(size>1) from collect(
LabEvent(eval( dateWithinLastMonths(effectiveTime,1)),
LabResult( value >1.8) from results)

Of course, the problem is that collect expects a single pattern...

Does anyone has a simple idea how to express this business logic?

Thanks, Yoni
View this message in context: http://www.nabble.com/count-with-nested-condition-tp18710506p18710506.html
Sent from the drools - user mailing list archive at Nabble.com.

rules-users mailing list

Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com