Thanks Thomas.<br><br><div class="gmail_quote">2011/7/6 Swindells, Thomas <span dir="ltr">&lt;<a href="mailto:TSwindells@nds.com">TSwindells@nds.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Add a name into the policyUpdated type – each type of rule which should operate separately only references policyUpdates of that given name so you stop those from retriggering while allowing the others to trigger.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thomas<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size: 11pt; color: rgb(31, 73, 125);"><u></u> <u></u></span></p><div style="border-width: medium medium medium 1.5pt; border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; padding: 0cm 0cm 0cm 4pt;">
<div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; padding: 3pt 0cm 0cm;"><p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Wishing Carebear<br>
<b>Sent:</b> 06 July 2011 14:17<br><b>To:</b> Rules Users List<br><b>Subject:</b> Re: [rules-users] How to update the working memory of a nested object attribute<u></u><u></u></span></p></div></div><div><div></div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal" style="margin-bottom: 12pt;">Thanks Swindel.<br>The eligibilityScore is updated on 3 different rules by decrementing the value if the condition is satisfied. Finally the eligibilityScore value is used in the downstream. Is there any pattern available for these types of use cases.<br>
<br><br><u></u><u></u></p><div><p class="MsoNormal">2011/7/6 Swindells, Thomas &lt;<a href="mailto:TSwindells@nds.com" target="_blank">TSwindells@nds.com</a>&gt;<u></u><u></u></p><div><div><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">You need a way to differentiate between policy’s that have been updated and that haven’t been updated.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">If you have control of your model then you could add an extra field, either as a flag or containing the new value – if this field is null you know you need to update it.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">If you can’t change that part of the model you can introduce a new class PolicyUpdated(Service policy). When you update the policy you insert one of these. You then change your conditions to add “not PolicyUpdated(policy == $policy)” which will then stop you retriggering yourself. Finally you need to tell drools that you have modified Client.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">It may be more efficient to actually fetch and insert the policy service objects into the working memory, then you only need to tell drools/your rules that you have updated one small part of your rules rather than getting it to reiterate over all the services every update.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thomas</span><u></u><u></u></p><p class="MsoNormal">
<span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span><u></u><u></u></p><div style="border-width: medium medium medium 1.5pt; border-style: none none none solid; padding: 0cm 0cm 0cm 4pt; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue;">
<div><div style="border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0cm 0cm; border-color: -moz-use-text-color;"><p class="MsoNormal"><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Wishing Carebear<br>
<b>Sent:</b> 06 July 2011 04:47<br><b>To:</b> Rules Users List<br><b>Subject:</b> [rules-users] How to update the working memory of a nested object attribute</span><u></u><u></u></p></div></div><div><div><p class="MsoNormal">
 <u></u><u></u></p><p class="MsoNormal" style="margin-bottom: 12pt;">Hi,<br>My rules update the nested object attributes :eligibilityScore which is used in another rule downstream.<br><br>Only the Client object is sent as fact, the nested object is derived using the from keyword (list of services)<br>
<br>rule  &quot;Rule 8 EligibilityRating&quot;<br>    agenda-group  &quot;EligibilityRating&quot;<br>    no-loop true<br>    salience 5<br>    //dialect  &quot;mvel&quot;<br>    when<br>        $client : Client(type == &quot;Preferred&quot;)<br>
        $policy : Service(productType == &quot;Vehicle Insurance&quot;) from $client.service<br>    then<br>        System.out.println(&quot; Rule 8 ER = type == preferred:&quot;+ $policy.getId() + &quot;: -50&quot;);<br>
        int eScore = $policy.getEligibilityScore() - 50;<br>       <b> $policy.setEligibilityScore(eScore);</b> // how to let the downstream rule know that this atribute value is updated without letting this current rule go into infinite loop<br>
end<br><br>Any suggestion is greatly appreciated<u></u><u></u></p></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p><div class="MsoNormal" style="text-align: center;" align="center"><hr size="2" align="center" width="100%">
</div><p class="MsoNormal"><span style="font-size: 7.5pt; color: gray;"><br>**************************************************************************************<br>This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com" target="_blank">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>**************************************************************************************</span><u></u><u></u></p>
</div><p class="MsoNormal" style="margin-bottom: 12pt;"><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div>
</div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>