Each (not <i>the</i>) Recommendation with the maximum recommValue can be found using<br><br>   $recMax: Recommendation( slot == 1, $recommValue: recommValue)<br>   not Recommendation( slot == 1, recommValue &gt; $recommValue )<br>
<br>with $recMax being bound to one of the Recommendations with the maximum,<br>and the maximum value being bound to $recommValue.<br><br>-W<br><br><div class="gmail_quote">On 24 November 2012 13:18, raffi <span dir="ltr">&lt;<a href="mailto:christian.koehler@s2008.tu-chemnitz.de" target="_blank">christian.koehler@s2008.tu-chemnitz.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I have a problem with using the /from accumulate/ statement. It is because<br>
I&#39;d like to optmize my code a liitle bit. There are two rules that I like to<br>
merge.<br>
<br>
/query &quot;max recomm value for slot 1&quot;<br>
        accumulate (Recommendation(slot == 1, $recomm_value : recommValue),<br>
                                max     : max($recomm_value))<br>
end/<br>
<br>
and<br>
<br>
/query &quot;recomms for slot 1&quot;<br>
        recomm  : Recommendation(slot == 1)<br>
end/<br>
<br>
So with the first rule I get the maximum of the variable recommValue. The<br>
second rule is for searching exactly this Recommendation-fact with this<br>
value. Now I tried to merge them in the following way:<br>
/<br>
query &quot;recomm for slot 1&quot;<br>
        $recomm : Recommendation() from<br>
                                        accumulate(Recommendation(<br>
                                                slot == 1, $recomm_value : recommValue),<br>
                                                max($recomm_value)<br>
                                        )<br>
end/<br>
<br>
But the returned value always is a double one. Is it because of the usage of<br>
the maximum function? Is it possible to solve this problem with only one<br>
query (getting that Recommendation-fact with the highest recommValue)?<br>
<br>
Regards...<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/using-from-accumulate-with-wrong-return-type-tp4020957.html" target="_blank">http://drools.46999.n3.nabble.com/using-from-accumulate-with-wrong-return-type-tp4020957.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>