<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
First I'm new to drools and secondly where I'm working we're using version 4.0.7.<br><br>I have a list of accounts and each account contains a list of transactions. I wish to accumulate charge transactions and compare them to an accumulation of payment transactions for a given time period (such as the last month). And it gets slightly more awkward in that if a payment transaction is of a certain type it needs to be converted from a 4 weekly figure to a monthly figure ( using / 4 / 7 * 365 / 12). I've tried to use structures as follows 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 /><hr />Beyond Hotmail - see what else you can do with Windows Live. <a href='http://clk.atdmt.com/UKM/go/134665375/direct/01/' target='_new'>Find out more.</a></body>
</html>