[rules-users] Getting one type from a collection of multiple types

lhorton LHorton at ABCLegal.com
Mon Aug 29 16:52:47 EDT 2011


Thank you for the hints.  I have implemented a method to hide the instanceof
code, and tried using the accumulate CE.  The LHS of my rule is now:

$step : Step()
$highScore : Number() from accumulate ( $location : VendorAddress () from
$step.job.scorableLocations,
        max($location.abcScore) )

in my RHS I can display the score this way:

System.out.println(" MAX SCORE IS: " + $highScore );

and verify that the accumulate is indeed choosing the max score.  HOWEVER,
what I really want is not the max score, but the ADDRESS with the max score.  
if I try to use $location in my RHS like this:

System.out.println("high score is: " + $location.getAbcScore());

I get compile time exception:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.$location()]

It looks like my $location variable is usable in the LHS but does not get
scope to the RHS.  

--
View this message in context: http://drools.46999.n3.nabble.com/Getting-one-type-from-a-collection-of-multiple-types-tp3287877p3293744.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list