<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, "Position" 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 <wolfgang.laun@gmail.com></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 <rules-users@lists.jboss.org></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 <dwipin.c@tcs.com><br>
><br>
> Without the accumulate function, following is the fire occurrence-<br>
><br>
> $position : Position() - 2<br>
> $posScn : PositionScenario(scenario == 'SCEN-EOD', position == $position
) - 2 ( with all above facts)<br>
> $posScnGrp : PositionScenarioCurrencyGroup(positionScenario == $posScn,
currencyType == CurrencyTypes.TRANSACTIONAL) - 2 ( with all above facts)<br>
> $posPnlAmt : PositionPnlAmount(pnlAmountType == "DTD", positionScenarioCurrencyGroup
== $posScnGrp) - 3 ( with all above facts)<br>
><br>
> $attibAmtType : AttributionAmountType(attributionAmountType == "UNEXPLAINED/RESIDUALPNL")
- 2 (just this fact)<br>
><br>
> All of them together without the accumulate fires it 6 times.<br>
><br>
><br>
> Dwipin<br>
><br>
><br>
><br>
> From: Wolfgang Laun <wolfgang.laun@gmail.com><br>
> To: Rules Users List <rules-users@lists.jboss.org><br>
> Date: 04/07/2011 01:16 PM<br>
> Subject: Re: [rules-users] Help with Accumulate function<br>
> Sent by: rules-users-bounces@lists.jboss.org<br>
> ________________________________<br>
><br>
><br>
> 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>
><br>
> On 7 April 2011 08:44, dwipin <dwipin.c@tcs.com> wrote:<br>
> Hi,<br>
> I am having trouble implementing this rule with the accumulate
function.<br>
> My rule requirement is -<br>
> Aggregate all PnlAttributionAmounts with a type of "UNEXPLAINED"
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 == "DTD",<br>
> positionScenarioCurrencyGroup == $posScnGrp)<br>
> $attibAmtType : AttributionAmountType(attributionAmountType ==<br>
> "UNEXPLAINED/RESIDUALPNL")<br>
><br>
> $totalPnlAttibAmt : BigDecimal()<br>
> from accumulate(<br>
> PositionPnlAttributionAmount(positionPnlAmount
==<br>
> $posPnlAmt, attributionAmountType == $attibAmtType, $pnlAttibAmt :<br>
> financialValue)<br>
> ,sum($pnlAttibAmt)<br>
> )<br>
><br>
> eval ($totalPnlAttibAmt > 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.<br>
><br>
><br>
> --<br>
> 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>
> Sent from the Drools - User mailing list archive at Nabble.com.<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>
> _______________________________________________<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>
><br>
><br>
> =====-----=====-----=====<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>
><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>
><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>