<br><tt><font size=2>Thanks Wolfgang. </font></tt>
<br>
<br><tt><font size=2>The issue here is that the accumulation has to happen
at a higher level in<br>
the object hierarchy, &quot;Position&quot; in this case. However, this
is no direct<br>
link between Position and PostitionPnlAttributionAmount ( which is being<br>
accumulated). How do I tackle such a scenario?</font></tt>
<br>
<br><tt><font size=2>$attibAmtType will be just one for the condition given,
but there could be multiple $posPnlAmt within a Position. </font></tt>
<br>
<br><font size=2 face="sans-serif">Thanks,<br>
Dwipin<br>
</font>
<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 02:08 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><tt><font size=2>Well, this explains it - you'll have to find the selecting
combination<br>
of $posPnlAmt and $attibAmtType in a unique way, assuming there is<br>
just one such combination.<br>
<br>
-W<br>
<br>
<br>
<br>
<br>
2011/4/7 Dwipin C &lt;dwipin.c@tcs.com&gt;<br>
&gt;<br>
&gt; Without the accumulate function, following is the fire occurrence-<br>
&gt;<br>
&gt; $position : Position() - 2<br>
&gt; $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position
) - 2 ( with all above facts)<br>
&gt; $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
currencyType == CurrencyTypes.TRANSACTIONAL) - 2 ( with all above facts)<br>
&gt; $posPnlAmt : PositionPnlAmount(pnlAmountType == &quot;DTD&quot;, positionScenarioCurrencyGroup
== $posScnGrp) - 3 ( with all above facts)<br>
&gt;<br>
&gt; $attibAmtType : AttributionAmountType(attributionAmountType == &quot;UNEXPLAINED/RESIDUALPNL&quot;)
- 2 (just this fact)<br>
&gt;<br>
&gt; All of them together without the accumulate fires it 6 times.<br>
&gt;<br>
&gt;<br>
&gt; Dwipin<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; From: Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt;<br>
&gt; To: Rules Users List &lt;rules-users@lists.jboss.org&gt;<br>
&gt; Date: 04/07/2011 01:16 PM<br>
&gt; Subject: Re: [rules-users] Help with Accumulate function<br>
&gt; Sent by: rules-users-bounces@lists.jboss.org<br>
&gt; ________________________________<br>
&gt;<br>
&gt;<br>
&gt; Repeated firing may be due to there being more than one scope for
accumulating<br>
&gt; the sum, as selected by the patterns leading up to the accumulate.<br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; -W<br>
&gt;<br>
&gt;<br>
&gt; On 7 April 2011 08:44, dwipin &lt;dwipin.c@tcs.com&gt; wrote:<br>
&gt; Hi,<br>
&gt; &nbsp;I am having trouble implementing this rule with the accumulate
function.<br>
&gt; My rule requirement is -<br>
&gt; Aggregate all PnlAttributionAmounts with a type of &quot;UNEXPLAINED&quot;
for all<br>
&gt; Positions for a given day.<br>
&gt;<br>
&gt; Below is the code I have for this -<br>
&gt;<br>
&gt; $position : Position(date == $currDate)<br>
&gt; $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position
)<br>
&gt; $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,<br>
&gt; currencyType == CurrencyTypes.TRANSACTIONAL)<br>
&gt; $posPnlAmt : PositionPnlAmount(pnlAmountType == &quot;DTD&quot;,<br>
&gt; positionScenarioCurrencyGroup == $posScnGrp)<br>
&gt; $attibAmtType : AttributionAmountType(attributionAmountType ==<br>
&gt; &quot;UNEXPLAINED/RESIDUALPNL&quot;)<br>
&gt;<br>
&gt; $totalPnlAttibAmt : BigDecimal()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;from accumulate(<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PositionPnlAttributionAmount(positionPnlAmount
==<br>
&gt; $posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :<br>
&gt; financialValue)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,sum($pnlAttibAmt)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp;)<br>
&gt;<br>
&gt; eval ($totalPnlAttibAmt &gt; 1000)<br>
&gt;<br>
&gt; When I do it this way, the rule gets executed 6 times, basically for
every<br>
&gt; fact that evaluated to true. How do I restrict this? The rule should
be<br>
&gt; executed only if the final eval results in true.<br>
&gt;<br>
&gt; Thanks for any help,<br>
&gt; Dwipin.<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context: </font></tt><a href="http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html"><tt><font size=2>http://drools-java-rules-engine.46999.n3.nabble.com/Help-with-Accumulate-function-tp2789194p2789194.html</font></tt></a><tt><font size=2><br>
&gt; Sent from the Drools - User mailing list archive at Nabble.com.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; rules-users@lists.jboss.org<br>
&gt; </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>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; rules-users@lists.jboss.org<br>
&gt; </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>
&gt;<br>
&gt;<br>
&gt; =====-----=====-----=====<br>
&gt; Notice: The information contained in this e-mail<br>
&gt; message and/or attachments to it may contain<br>
&gt; confidential or privileged information. If you are<br>
&gt; not the intended recipient, any dissemination, use,<br>
&gt; review, distribution, printing or copying of the<br>
&gt; information contained in this e-mail message<br>
&gt; and/or attachments to it are strictly prohibited. If<br>
&gt; you have received this communication in error,<br>
&gt; please notify us by reply e-mail or telephone and<br>
&gt; immediately and permanently delete the message<br>
&gt; and any attachments. Thank you<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; rules-users@lists.jboss.org<br>
&gt; </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>
&gt;<br>
<br>
_______________________________________________<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>