[rules-dev] Rule syntax to accumulate time segments over a limited set of date ranges

Mauricio Salatino salaboy at gmail.com
Thu May 6 16:32:06 EDT 2010


you have the start and end date, you can filter with that information?
CrewSegment( personId == $s.personId, $crewHours : crewHours, startDate <=
"<date>", endDate => "<date>" ),

Greetings.
On Thu, May 6, 2010 at 4:24 PM, <billhainaut at gmail.com> wrote:

> Drools Experts:
>
> I have a list of the following fact objects sent to my rules:
>
> CrewSegment
> Date startDate
> Date endDate
> double crewHours
> int personId
>
> along with an object to designate seats:
>
> SeatAssignment
> int seatId
> int personId
>
> Here is the rule I want to enforce in English: No crew member (uniquely
> identified by personId) can have more than 56 hours of total crewHours in
> any 7 day period. The rule I've written so far is:
>
> when
> $s : SeatAssignment ( )
> $total : Number( doubleValue > 56 )
> from accumulate( CrewSegment( personId == $s.personId, $crewHours :
> crewHours ),
> sum( $crewHours ) )
>
> This rule nicely catches any instance where more than 56 hours are
> committed by a person, but does not limit the time period to 7 days.
>
> How do I limit the search to be sure that it is 56 hours WITHIN 7 days, and
> not just 56 hours total over ANY time period?
>
> Thanks in advance for any help you can provide!!!
>
> Bill
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>


-- 
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20100506/6e7691e8/attachment-0001.html 


More information about the rules-dev mailing list