[rules-users] Calculating minimal value for a group of facts

Steve Ronderos steve.ronderos at ni.com
Mon Aug 31 15:09:41 EDT 2009


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 at gmail.com>
To:
rules-users at 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 at 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 at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090831/c28306e9/attachment.html 


More information about the rules-users mailing list