Hi All,
I have aother question on drools.
There can le level1 to level6 present in a rule and we need to pick always
the highest level rule which satisfied list price and discount comdition.
Following code is giving me expected results but do we have any better way
to implement the same. Can I avoid last 2 iternations and combine it to
first one iteration.
RoutingRule.java
----------------
private String level1 = "";
private String level2 = "";
private String level3 = "";
private String level4 = "";
private String level5 = "";
private String level6 = "";
private String serviceSalesPath = "";
private String productSalesPath = "";
private String nonStdTerm = "";
private String currency = "";
private double listPriceFrom = Double.MAX_VALUE ;
private double listPriceTo = Double.MAX_VALUE ;
private double discountPriceFrom = 100;
private double discountPriceTo = 100 ;
private double nodeOfRule =0;
Rule
-----
$selectedTSSRulesWithOutHier : ArrayList()
from collect ($routingRule : RoutingRule(currency == $curr
&& (
listPriceFrom <= $tssListPrice && listPriceTo > $tssListPrice
&& discountPriceFrom <= $tssDisc && discountPriceTo > $tssDisc
&&
nonStdTerm =="TSS" )
)
from $tssRoutingRuleList)
$lowestNodeTSS : Double(intValue > 0)
from accumulate ( RoutingRule($nodeOfRule : nodeOfRule)
from $selectedTSSRulesWithOutHier, max($nodeOfRule))
$lowestNodeTSSRule : ArrayList()
from collect( $ruleObj : RoutingRule( eval(nodeOfRule == $lowestNodeTSS) )
from $selectedTSSRulesWithOutHier )
Many thanks in advance,
Gaurav
--
View this message in context:
http://n3.nabble.com/Better-way-to-find-rule-with-max-value-tp442484p4424...
Sent from the Drools - User mailing list archive at
Nabble.com.