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