<br>   Also, please note that the repeated use of &quot;from $acc.transactions&quot; will cripple the performance of your rules. The transactions should be asserted into the working memory to avoid the problem. <br><br>   []s<br>
   Edson<br><br><div class="gmail_quote">2009/7/14 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You&#39;ll have to provide one full set of $acc.transaction values<br>
(indicating class and relevant field values) where you think the rule<br>
should fire, but doesnt, for people to be able to check what&#39;s going<br>
on.<br>
<br>
Also, it is necessary to know how the types of Account.transactions<br>
(List&lt;???&gt;), Transaction and RentTransaction are related.<br>
<br>
-W<br>
<div><div></div><div class="h5"><br>
On 7/14/09, Richard Sherman &lt;<a href="mailto:rsherman315@hotmail.com">rsherman315@hotmail.com</a>&gt; wrote:<br>
&gt; First I&#39;m new to drools and secondly where I&#39;m working we&#39;re using version<br>
&gt; 4.0.7.<br>
&gt;<br>
&gt; I have a list of accounts and each account contains a list of transactions.<br>
&gt; I wish to accumulate charge transactions and compare them to an accumulation<br>
&gt; of payment transactions for a given time period (such as the last month).<br>
&gt; And it gets slightly more awkward in that if a payment transaction is of a<br>
&gt; certain type it needs to be converted from a 4 weekly figure to a monthly<br>
&gt; figure ( using / 4 / 7 * 365 / 12). I&#39;ve tried to use structures as follows<br>
&gt; but they are causing the then part of the rule never to fire.<br>
&gt;<br>
&gt; rule &quot;Account in arrears&quot;<br>
&gt;     salience 10<br>
&gt;     no-loop<br>
&gt;     when<br>
&gt;         $acc : Account( // balance between £500 and £1000<br>
&gt;             accountBalanceInPence &gt;=  50000 &amp;&amp;<br>
&gt;             accountBalanceInPence &lt;= 100000<br>
&gt;         )<br>
&gt;<br>
&gt;         $s  : MessageInfo( accountNumber == $acc.accountNumber )<br>
&gt;<br>
&gt;         Number($charges : intValue) from<br>
&gt;                     accumulate(<br>
&gt;                         (Transaction(<br>
&gt;                                transactionDate &gt; oneMonthAgo &amp;&amp;<br>
&gt;                                amountInPence &gt; 0 &amp;&amp;<br>
&gt;                                $value : amountInPence)<br>
&gt;                        from $acc.transactions),<br>
&gt;                         sum($value)<br>
&gt;                     )<br>
&gt;<br>
&gt;         Number($adjustment : intValue) from<br>
&gt;             accumulate(<br>
&gt;                 (Transaction(<br>
&gt;                            transactionDate &gt; oneMonthAgo &amp;&amp;<br>
&gt;                            amountInPence &lt; 0 &amp;&amp;<br>
&gt;                            transactionCode == &quot;Type 1&quot; &amp;&amp;<br>
&gt;                            $value : amountInPence)<br>
&gt;                        from $acc.transactions),<br>
&gt;                    sum(($value / 4 / 7 * 365 / 12) - $value)<br>
&gt;                )<br>
&gt;<br>
&gt;<br>
&gt;         Number( intValue &gt; ($charges + $adjustment)) from<br>
&gt;                 accumulate(<br>
&gt;                     (RentTransaction<br>
&gt;                             (transactionDate &gt; oneMonthAgo<br>
&gt;                             $value : amountInPence)<br>
&gt;                         from $acc.transactions),<br>
&gt;                     sum($value)<br>
&gt;                 )<br>
&gt;<br>
&gt;     then<br>
&gt;         $s.setMessage( &quot;Account in arrears&quot; );<br>
&gt;         update($s); // flag update<br>
&gt; end<br>
&gt;<br>
&gt; Thanks<br>
&gt; Richard<br>
&gt;<br>
&gt; ________________________________<br>
&gt; Beyond Hotmail - see what else you can do with Windows Live. Find out more.<br>
</div></div>&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
<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><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>