<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Thanks Wolfgang,<br><br>Here's the extra information as requested.<br>Firstly the When creating the email I was removing all references to rent and missed one hence RentTransaction should read Transaction. I've also noticed that the sum($value) in the third accumulation should read sum(-$value).<br><br>Below is a typical set of Transactions that should cause a message to occur.<br><br><font style="" face="Courier New">Account :</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> accountBalanceInPence : 70000</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> transactions :</font><font style="" face="Courier New"><br></font><font style="" face="Courier New"> - transactionDate : </font><font style="" face="Courier New">2009/07/10<br> amountInPence : 50000<br> </font><font style="" face="Courier New">transactionCode </font><font style="" face="Courier New">: charge</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> - transactionDate : </font><font style="" face="Courier New">2009/07/12<br>
amountInPence : 45000<br>
</font><font style="" face="Courier New">transactionCode </font><font style="" face="Courier New">: Type 1</font><br>
<br>
Below is a similar set of Transactions that shouldn't cause a message to occur.<br>
<br>
<font style="" face="Courier New">Account :</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> accountBalanceInPence : 70000</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> transactions :</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> - transactionDate : </font><font style="" face="Courier New">2009/07/10<br>
amountInPence : 50000<br>
</font><font style="" face="Courier New">transactionCode </font><font style="" face="Courier New">: charge</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> - transactionDate : </font><font style="" face="Courier New">2009/07/12<br>
amountInPence : 45000<br>
</font><font style="" face="Courier New">transactionCode </font><font style="" face="Courier New">: Type 1</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New"> - transactionDate : </font><font style="" face="Courier New">2009/07/13<br>
amountInPence : 5000<br>
</font><font style="" face="Courier New">transactionCode </font><font style="" face="Courier New">: Type 2</font><br><br><font style="" face="Courier New">Thanks<br>Richard<br></font><br><br>>From: wolfgang.laun@gmail.com<br>>To: rules-users@lists.jboss.org<br>>Date: Tue, 14 Jul 2009 12:43:40 +0200<br>>Subject: Re: [rules-users] Comparing multiple accumulations<br>><br>>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>><br>>On 7/14/09, Richard Sherman <rsherman315@hotmail.com> 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>>> _______________________________________________<br>>> rules-users mailing list<br>>> rules-users@lists.jboss.org<br>>> https://lists.jboss.org/mailman/listinfo/rules-users<br /><hr />View your Twitter and Flickr updates from one place – <a href='http://clk.atdmt.com/UKM/go/137984870/direct/01/' target='_new'>Learn more!</a></body>
</html>