<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt">Thanks, that is what I need.<br><br>>but that's for you to resolve.<br><br>I will :-)<br><div><span><br></span></div><div> </div><div>-----------------<br>http://www.codessentials.com - Your essential software, for free!<br>Follow us at http://twitter.com/#!/Codessentials<br></div> <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Wolfgang Laun <wolfgang.laun@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Michiel Vermandel <mvermand@yahoo.com>; Rules Users List <rules-users@lists.jboss.org> <br> <b><span style="font-weight:
bold;">Sent:</span></b> Tuesday, February 19, 2013 5:29 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] How can I select planning-entities in the accumulate source-pattern based on a list of planning-variables?<br> </font> </div> <br>
Assuming you want to deal with one PeopleMatch at a time:<br><br>when<br> $match : PeopleMatch( $people: people )<br> $match: Number( intValue < 0 )<br> from accumulate( $task : Task(handler memberOf $people), ...<br><br>I have some misgivings due to "intValue<0" and Matcher not being<br>assignment-compatible with java.lang.Number, but that's for you to<br>resolve.<br><br>-W<br><br><br>On 19/02/2013, Michiel Vermandel <<a ymailto="mailto:mvermand@yahoo.com" href="mailto:mvermand@yahoo.com">mvermand@yahoo.com</a>> wrote:<br>> Hi,<br>><br>> I am kind of stuck in writing a rule :<br>><br>><br>> I have PeopleMatch facts in working memory.<br>> Each PeopleMatch has a number of persons: PeopleMatch().getPeople =<br>> List<Person><br>><br>><br>> I have planning-entities (Tasks) which have a planning-variable
Person.<br>><br>> Now I would like to create a rule to loop over the PeopleMatch objects,<br>> gather all Tasks for the people of this match and do some calculation with<br>> all tasks.<br>><br>> This is what I have for the moment:<br>><br>> rule "matchPeopleTasks"<br>> when<br>><br>> $match : PeopleMatch()<br>> $people : List() from $match .people<br>><br>> $match: Number( intValue < 0 )<br>> from accumulate( $task : Task(handler == $people),<br>> init( Matcher matcher =<br>> $match.getMatcher()),<br>>
action( matcher.addTask( $task ); ),<br>> reverse( matcher.removeTask( $task ); ),<br>> result( matcher.getMatch() ) );<br>> then<br>> ...<br>> end<br>><br>><br>> The problem area is of course the "accumulate( $task : ProjectTask(handler<br>> == $people),"<br>> How do I select all tasks in the accumulate function, based on a list of<br>> people?<br>><br>> Thanks,<br>><br>> Michiel<br>><br>><br>> -----------------<br>> http://www.codessentials.com - Your essential software, for free!<br>> Follow us at http://twitter.com/#!/Codessentials<br><br><br> </div> </div> </div></body></html>