Hi,

I am kind of stuck in writing a rule :

I have PeopleMatch facts in working memory.
Each PeopleMatch has a number of persons:  PeopleMatch().getPeople = List<Person>

I have planning-entities (Tasks) which have a planning-variable Person.

Now I would like to create a rule to loop over the PeopleMatch objects, gather all Tasks for the people of this match and do some calculation with all tasks.

This is what I have for the moment:

rule "matchPeopleTasks"
   when

        $match : PeopleMatch()
        $people :  List() from $
match .people

        $match: Number( intValue < 0 )
                   from accumulate( $task : Task(handler == $people),
                                    init( Matcher matcher = $match.getMatcher()),
                                    action(
matcher.addTask( $task ); ),
                                    reverse(
matcher.removeTask( $task ); ),
                                    result(
matcher.getMatch() ) );
  then
        ...
end
 
The problem area is of course the "accumulate( $task : ProjectTask(handler == $people),"
How do I select all tasks in the accumulate function, based on a list of people?

Thanks,

Michiel

-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials