[rules-users] Comparing multiple accumulations

Richard Sherman rsherman315 at hotmail.com
Wed Jul 15 03:56:13 EDT 2009


Thanks very much Wolfgang it was seeing the "2P" in your equation that made
me realise that I had missed the "amountInPence < 0 &&" in the final
accumulation. Its now working fine.

Richard


Wolfgang Laun-2 wrote:
> 
> For simplicity's sake, I'll only consider the first example, where all
> transactions with amount < 0 are also Type 1.
> 
> Let P be the sum of the positive values and N (<0) the sum of the
> negative values over all transactions. Then
>    $charges = P
>    $adjustment = 29/336*N
>    intValue = -P - N
> 
> The last CE would be true if
>    -P - N > P + 29/336*N
>    2P < -N(1+29/336)
> 
> Since P > |N| (in the first example), clearly this cannot be true.
> 
> -W
> 
> 
>>> >>>
>>> >>>         Number( intValue > ($charges + $adjustment)) from
>>> >>>                 accumulate(
>>> >>>                     (RentTransaction
>>> >>>                             (transactionDate > oneMonthAgo
>>> >>>                             $value : amountInPence)
>>> >>>                         from $acc.transactions),
>>> >>>                     sum($value)
>>> >>>                 )
>>> >>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Comparing-multiple-accumulations-tp24476495p24493359.html
Sent from the drools - user mailing list archive at Nabble.com.





More information about the rules-users mailing list