<br> Also, please note that the repeated use of "from $acc.transactions" 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"><<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>></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'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's going<br>
on.<br>
<br>
Also, it is necessary to know how the types of Account.transactions<br>
(List<???>), Transaction and RentTransaction are related.<br>
<br>
-W<br>
<div><div></div><div class="h5"><br>
On 7/14/09, Richard Sherman <<a href="mailto:rsherman315@hotmail.com">rsherman315@hotmail.com</a>> wrote:<br>
> First I'm new to drools and secondly where I'm working we're using version<br>
> 4.0.7.<br>
><br>
> I have a list of accounts and each account contains a list of transactions.<br>
> I wish to accumulate charge transactions and compare them to an accumulation<br>
> of payment transactions for a given time period (such as the last month).<br>
> And it gets slightly more awkward in that if a payment transaction is of a<br>
> certain type it needs to be converted from a 4 weekly figure to a monthly<br>
> figure ( using / 4 / 7 * 365 / 12). I've tried to use structures as follows<br>
> but they are causing the then part of the rule never to fire.<br>
><br>
> rule "Account in arrears"<br>
> salience 10<br>
> no-loop<br>
> when<br>
> $acc : Account( // balance between £500 and £1000<br>
> accountBalanceInPence >= 50000 &&<br>
> accountBalanceInPence <= 100000<br>
> )<br>
><br>
> $s : MessageInfo( accountNumber == $acc.accountNumber )<br>
><br>
> Number($charges : intValue) from<br>
> accumulate(<br>
> (Transaction(<br>
> transactionDate > oneMonthAgo &&<br>
> amountInPence > 0 &&<br>
> $value : amountInPence)<br>
> from $acc.transactions),<br>
> sum($value)<br>
> )<br>
><br>
> Number($adjustment : intValue) from<br>
> accumulate(<br>
> (Transaction(<br>
> transactionDate > oneMonthAgo &&<br>
> amountInPence < 0 &&<br>
> transactionCode == "Type 1" &&<br>
> $value : amountInPence)<br>
> from $acc.transactions),<br>
> sum(($value / 4 / 7 * 365 / 12) - $value)<br>
> )<br>
><br>
><br>
> Number( intValue > ($charges + $adjustment)) from<br>
> accumulate(<br>
> (RentTransaction<br>
> (transactionDate > oneMonthAgo<br>
> $value : amountInPence)<br>
> from $acc.transactions),<br>
> sum($value)<br>
> )<br>
><br>
> then<br>
> $s.setMessage( "Account in arrears" );<br>
> update($s); // flag update<br>
> end<br>
><br>
> Thanks<br>
> Richard<br>
><br>
> ________________________________<br>
> Beyond Hotmail - see what else you can do with Windows Live. Find out more.<br>
</div></div>> _______________________________________________<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>
><br>
><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>