You can use a collect statement to get all of the Job objects.

  $list : ArrayList() from collect ( Job() )

alternatively if all that your service method call is doing is comparing the values of a field in a list of Job objects, there are ways to do that without the eval

when
  $shortest : Job ( $min : min)
  not Job(min < $min)
then
  go go go!

Hope this helps!

Steve Ronderos


From: kothvandir kothvandir <kothvandir@gmail.com>
To: rules-users@lists.jboss.org
Date: 08/31/2009 01:35 PM
Subject: [rules-users] Calculating minimal value for a group of facts
Sent by: rules-users-bounces@lists.jboss.org





Hi,

I need to calculate the min time for a set of "jobs" inserted in working mermory to know wich job is going to be finished first.

Is there any way to obtain within a rule the current facts of some type to pass then to a function/method? 
somethin like this:

Another idea to acomplish this?


gobal MyService myservice

rule "cmdCheckTime" ruleflow-group "comprobarExistencias"
when
Job(time = eval(myService.getMinTime( <jobs in working memory >))
then 
go, go, go...

end

Thank you_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users