<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">&nbsp; accountBalanceInPence : 70000</font><font style="" face="Courier New"><br></font><font style="" face="Courier New">&nbsp; transactions :</font><font style="" face="Courier New"><br></font><font style="" face="Courier New">&nbsp;&nbsp;&nbsp; - transactionDate : </font><font style="" face="Courier New">2009/07/10<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; amountInPence : 50000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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">&nbsp;&nbsp;&nbsp; - transactionDate : </font><font style="" face="Courier New">2009/07/12<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; amountInPence : 45000<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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">&nbsp; accountBalanceInPence : 70000</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">&nbsp; transactions :</font><font style="" face="Courier New"><br>
</font><font style="" face="Courier New">&nbsp;&nbsp;&nbsp; - transactionDate : </font><font style="" face="Courier New">2009/07/10<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; amountInPence : 50000<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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">&nbsp;&nbsp;&nbsp; - transactionDate : </font><font style="" face="Courier New">2009/07/12<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; amountInPence : 45000<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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">&nbsp;&nbsp;&nbsp; - transactionDate : </font><font style="" face="Courier New">2009/07/13<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; amountInPence : 5000<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </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>&gt;From: wolfgang.laun@gmail.com<br>&gt;To: rules-users@lists.jboss.org<br>&gt;Date: Tue, 14 Jul 2009 12:43:40 +0200<br>&gt;Subject: Re: [rules-users] Comparing multiple accumulations<br>&gt;<br>&gt;You'll have to provide one full set of $acc.transaction values<br>&gt;(indicating class and relevant field values) where you think the rule<br>&gt;should fire, but doesnt, for people to be able to check what's going<br>&gt;on.<br>&gt;<br>&gt;Also, it is necessary to know how the types of Account.transactions<br>&gt;(List&lt;???&gt;), Transaction and RentTransaction are related.<br>&gt;<br>&gt;-W<br>&gt;<br>&gt;On 7/14/09, Richard Sherman &lt;rsherman315@hotmail.com&gt; wrote:<br>&gt;&gt; First I'm new to drools and secondly where I'm working we're using version<br>&gt;&gt; 4.0.7.<br>&gt;&gt;<br>&gt;&gt; I have a list of accounts and each account contains a list of transactions.<br>&gt;&gt; I wish to accumulate charge transactions and compare them to an accumulation<br>&gt;&gt; of payment transactions for a given time period (such as the last month).<br>&gt;&gt; And it gets slightly more awkward in that if a payment transaction is of a<br>&gt;&gt; certain type it needs to be converted from a 4 weekly figure to a monthly<br>&gt;&gt; figure ( using / 4 / 7 * 365 / 12). I've tried to use structures as follows<br>&gt;&gt; but they are causing the then part of the rule never to fire.<br>&gt;&gt;<br>&gt;&gt; rule "Account in arrears"<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; salience 10<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; no-loop<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; when<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $acc : Account( // balance between £500 and £1000<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; accountBalanceInPence &gt;=&nbsp; 50000 &amp;&amp;<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; accountBalanceInPence &lt;= 100000<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br>&gt;&gt;<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $s&nbsp; : MessageInfo( accountNumber == $acc.accountNumber )<br>&gt;&gt;<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Number($charges : intValue) from<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; accumulate(<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Transaction(<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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $value : amountInPence)<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from $acc.transactions),<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum(($value / 4 / 7 * 365 / 12) - $value)<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Number( intValue &gt; ($charges + $adjustment)) from<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; accumulate(<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (RentTransaction<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (transactionDate &gt; oneMonthAgo<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $value : amountInPence)<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from $acc.transactions),<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum($value)<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )<br>&gt;&gt;<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; then<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $s.setMessage( "Account in arrears" );<br>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; update($s); // flag update<br>&gt;&gt; end<br>&gt;&gt;<br>&gt;&gt; Thanks<br>&gt;&gt; Richard<br>&gt;&gt;<br>&gt;&gt; ________________________________<br>&gt;&gt; Beyond Hotmail - see what else you can do with Windows Live. Find out more.<br>&gt;&gt; _______________________________________________<br>&gt;&gt; rules-users mailing list<br>&gt;&gt; rules-users@lists.jboss.org<br>&gt;&gt; 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>