Hi, Yes, your proposed solution does work. Unfortunately, the accumulate-count function is not well described in the documentation. In addition, I still have a concern. The required business functionality is simple, but the implementing rule is very technical and not trivial. I can hardly expect a business user to write such a rule. Providing a DSL for accumulate looks (at least to my eyes) impossible. Will it help to assert the LabResults to the working memory (in addition to the LabEvents)? Will it help to split this logic to two rules (one filters the LabEvents into a temporary collection, and one count this collection).
Thanks for the help, Yoni Edson Tirelli-3 wrote: > > 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. > > []s > Edson > > 2008/7/29 Yoni Mazar <[EMAIL PROTECTED]> > >> >> 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)), >> results:laboratoryResult) >> 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 >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users >> > > > > -- > Edson Tirelli > JBoss Drools Core Development > JBoss, a division of Red Hat @ www.jboss.com > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > > -- View this message in context: http://www.nabble.com/count-with-nested-condition-tp18710506p18727321.html Sent from the drools - user mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
