<br><font size=2 face="Courier New">Without the accumulate function, following
is the fire occurrence- </font>
<br>
<br><font size=2 face="Courier New">$position : Position() </font><font size=2 face="sans-serif">-
2</font>
<br><font size=2 face="Courier New">$posScn : PositionScenario(scenario
== </font><font size=2 color=#008000 face="Courier New">'SCEN-EOD'</font><font size=2 face="Courier New">,
position == $position )</font><font size=2 face="sans-serif"> - 2 ( with
all above facts)</font>
<br><font size=2 face="Courier New">$posScnGrp : PositionScenarioCurrencyGroup(positionScenario
== $posScn, currencyType == CurrencyTypes.TRANSACTIONAL)</font><font size=2 face="sans-serif">
- 2 ( with all above facts)</font>
<br><font size=2 face="Courier New">$posPnlAmt : PositionPnlAmount(pnlAmountType
== </font><font size=2 color=#008000 face="Courier New">&quot;DTD&quot;</font><font size=2 face="Courier New">,
positionScenarioCurrencyGroup == $posScnGrp)</font><font size=2 face="sans-serif">
- 3 ( with all above facts)</font>
<br>
<br><font size=2 face="Courier New">$attibAmtType : AttributionAmountType(attributionAmountType
== </font><font size=2 color=#008000 face="Courier New">&quot;UNEXPLAINED/RESIDUALPNL&quot;</font><font size=2 face="Courier New">)</font><font size=2 face="sans-serif">
- 2 (just this fact)</font>
<br>
<br><font size=2 face="sans-serif">All of them together without the accumulate
fires it 6 times.</font>
<br>
<br><font size=2 face="sans-serif"><br>
Dwipin<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">Rules Users List &lt;rules-users@lists.jboss.org&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">04/07/2011 01:16 PM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">Re: [rules-users] Help with Accumulate
function</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Sent by:</font>
<td><font size=1 face="sans-serif">rules-users-bounces@lists.jboss.org</font></table>
<br>
<hr noshade>
<br>
<br>
<br><font size=3>Repeated firing may be due to there being more than one
scope for accumulating<br>
the sum, as selected by the patterns leading up to the accumulate.<br>
<br>
If you take only the patterns preceding the accumulate - how often does
this fire and for which elements? You need a single combination of $posPnlAm
and $attibAmtType.<br>
<br>
-W<br>
<br>
</font>
<br><font size=3>On 7 April 2011 08:44, dwipin &lt;</font><a href=mailto:dwipin.c@tcs.com><font size=3 color=blue><u>dwipin.c@tcs.com</u></font></a><font size=3>&gt;
wrote:</font>
<br><font size=3>Hi,<br>
&nbsp;I am having trouble implementing this rule with the accumulate function.<br>
My rule requirement is -<br>
Aggregate all PnlAttributionAmounts with a type of &quot;UNEXPLAINED&quot;
for all<br>
Positions for a given day.<br>
<br>
Below is the code I have for this -<br>
<br>
$position : Position(date == $currDate)<br>
$posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position
)<br>
$posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,<br>
currencyType == CurrencyTypes.TRANSACTIONAL)<br>
$posPnlAmt : PositionPnlAmount(pnlAmountType == &quot;DTD&quot;,<br>
positionScenarioCurrencyGroup == $posScnGrp)<br>
$attibAmtType : AttributionAmountType(attributionAmountType ==<br>
&quot;UNEXPLAINED/RESIDUALPNL&quot;)<br>
<br>
$totalPnlAttibAmt : BigDecimal()<br>
&nbsp; &nbsp; &nbsp; &nbsp;from accumulate(<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PositionPnlAttributionAmount(positionPnlAmount
==<br>
$posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :<br>
financialValue)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,sum($pnlAttibAmt)<br>
&nbsp; &nbsp; &nbsp; &nbsp;)<br>
<br>
eval ($totalPnlAttibAmt &gt; 1000)<br>
<br>
When I do it this way, the rule gets executed 6 times, basically for every<br>
fact that evaluated to true. How do I restrict this? The rule should be<br>
executed only if the final eval results in true.<br>
<br>
Thanks for any help,<br>
Dwipin.</font><font size=3 color=#8f8f8f><br>
<br>
<br>
--<br>
View this message in context: </font><a href="http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html" target=_blank><font size=3 color=blue><u>http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html</u></font></a><font size=3 color=#8f8f8f><br>
Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list</font><font size=3 color=blue><u><br>
</u></font><a href="mailto:rules-users@lists.jboss.org"><font size=3 color=blue><u>rules-users@lists.jboss.org</u></font></a><font size=3 color=blue><u><br>
</u></font><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank><font size=3 color=blue><u>https://lists.jboss.org/mailman/listinfo/rules-users</u></font></a>
<br><tt><font size=2>_______________________________________________<br>
rules-users mailing list<br>
rules-users@lists.jboss.org<br>
</font></tt><a href="https://lists.jboss.org/mailman/listinfo/rules-users"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/rules-users</font></tt></a><tt><font size=2><br>
</font></tt>
<br>
<br><pre style="white-space:normal">=====-----=====-----=====<br>Notice: The information contained in this e-mail<br>message and/or attachments to it may contain <br>confidential or privileged information. If you are <br>not the intended recipient, any dissemination, use, <br>review, distribution, printing or copying of the <br>information contained in this e-mail message <br>and/or attachments to it are strictly prohibited. If <br>you have received this communication in error, <br>please notify us by reply e-mail or telephone and <br>immediately and permanently delete the message <br>and any attachments. Thank you<br><br><br></pre>