<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>&gt;but that's for you to resolve.<br><br>I will :-)<br><div><span><br></span></div><div>&nbsp;</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 &lt;wolfgang.laun@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Michiel Vermandel &lt;mvermand@yahoo.com&gt;; Rules Users List &lt;rules-users@lists.jboss.org&gt; <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>&nbsp;  $match : PeopleMatch( $people: people )<br>&nbsp;  $match: Number( intValue &lt; 0 )<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from accumulate( $task : Task(handler memberOf $people), ...<br><br>I have some misgivings due to "intValue&lt;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 &lt;<a ymailto="mailto:mvermand@yahoo.com" href="mailto:mvermand@yahoo.com">mvermand@yahoo.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; I am kind of stuck in writing a rule :<br>&gt;<br>&gt;<br>&gt; I have PeopleMatch facts in working memory.<br>&gt; Each PeopleMatch has a number of persons:&nbsp; PeopleMatch().getPeople =<br>&gt; List&lt;Person&gt;<br>&gt;<br>&gt;<br>&gt; I have planning-entities (Tasks) which have a planning-variable
 Person.<br>&gt;<br>&gt; Now I would like to create a rule to loop over the PeopleMatch objects,<br>&gt; gather all Tasks for the people of this match and do some calculation with<br>&gt; all tasks.<br>&gt;<br>&gt; This is what I have for the moment:<br>&gt;<br>&gt; rule "matchPeopleTasks"<br>&gt;&nbsp; &nbsp; when<br>&gt;<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  $match : PeopleMatch()<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  $people :&nbsp; List() from $match .people<br>&gt;<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  $match: Number( intValue &lt; 0 )<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from accumulate( $task : Task(handler == $people),<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  init( Matcher matcher =<br>&gt; $match.getMatcher()),<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp;  action( matcher.addTask( $task ); ),<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  reverse( matcher.removeTask( $task ); ),<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  result( matcher.getMatch() ) );<br>&gt;&nbsp;  then<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp;  ...<br>&gt; end<br>&gt;<br>&gt;<br>&gt; The problem area is of course the "accumulate( $task : ProjectTask(handler<br>&gt; == $people),"<br>&gt; How do I select all tasks in the accumulate function, based on a list of<br>&gt; people?<br>&gt;<br>&gt; Thanks,<br>&gt;<br>&gt; Michiel<br>&gt;<br>&gt;<br>&gt; -----------------<br>&gt; http://www.codessentials.com - Your essential software, for free!<br>&gt; Follow us at http://twitter.com/#!/Codessentials<br><br><br> </div> </div>  </div></body></html>