[rules-users] Find the lowest and highest dates

LarryW lwakeman at tmghealth.com
Fri Feb 21 11:35:30 EST 2014


I'm beginning to think that there is no min or max accumulates in 5.0.  If
that's the case, then the accumulate function gets way too complicated (I
can see why I was asked not to use accumulate!)

In that case, is using java in the Then segment the way I've shown the best
technique?

Here's the accumulate I was asked to simplify, that does work:

	$lh : BeginAndEndDates() from accumulate(
		ServiceLineDetail(
			serviceRelatedDates != null,
			serviceRelatedDates.serviceDates != null,
			$beginDate : serviceRelatedDates.serviceDates.beginDate,
			$endDate : serviceRelatedDates.serviceDates.endDate
			)
			from $claim.serviceLineInfoList,
		init(BeginAndEndDates lh = new BeginAndEndDates(); boolean first = true;),
		action(
			if (first && $beginDate != null) {lh.setBeginDate($beginDate); first =
false; };
			if ($beginDate != null && $beginDate.isBefore(lh.getBeginDate()))
lh.setBeginDate($beginDate);
			if ($endDate != null && $endDate.isAfter(lh.getEndDate()))
{lh.setEndDate($endDate); };
			),
		result(lh)
		);



--
View this message in context: http://drools.46999.n3.nabble.com/Find-the-lowest-and-highest-dates-tp4028231p4028239.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list