Hi,
this is just a dumb question for drools-languaje gurus... like
Edson :)
How ca I write a rule (CE in LHS) for accumulate atributes inside an
object, but this objects are not facts,
they are inside a collection which is an attribute from a fact...
pretty messy right?...lol..
well, the business problem is this.
I need to count (accumulate) vacation days used on previous vacation
requests.
I have an User (which is one fact) having a collection of
oldVacationRequests
and an actual VacationRequest (the another fact).
So the rules is like this: discount to the available days for
vacation those used in previous
vacation request, and those days are the days between initDate and
endDate in each
old vacation request with isAproved seted true and having endDate
before the actual
vacation request initDate.
did I explain myself?...
so I need to know if this is possible I was trying to do something
like this...but is obviously wrong...:)
rule "remove used vacation days"
no-loop
when
vr: VacationRequestVO($days: availableDays , $iniDate: initDate )
$u: UserVO( $vacReqList: vacationRequestList )
$usedDays: Number (intValue > 1) from accumulate ( $ovr:
VacationRequestVO( isAproved == true, endDate < $iniDate, $uDays:
usedDays),
from $vacReqList, count($uDays))
then
vr.setAvailableDays($days - $usedDays);
end
Thanks...
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl