Adhir,<br>   Im facing the same challenge using rules in a ETL process where performance is a main concern (some millisecs do the different when you have<br>millions of executions), so I&#39;m using Globals to keep data in the session. You can add a global object as a global variable in the session scope and all<br>
the rules will have access to it in conditions and actions. <br><br>            MyHelperClass helper = new MyHelperClass();<br>            StatelessKnowledgeSession statelessSession  = kb.newStatelessKnowledgeSession();<br>
            if (statelessSession == null){<br>                log.error(&quot;Session was not created.&quot;);<br>                return;<br>            }<br>            statelessSession.setGlobal(&quot;myHelper&quot;, helper);<br>
<br>In the DRL you import the class and define the global. You can also define some static (or not) methods in the helper class to assit you and use them<br>as functions in your rules (if used as functions, methods needs to be static, if no static, then they can be used as methods of the global instance in<br>
the consequence block)<br><br>             import com.mycompany.rules.helpers.MyHelperClass;<br>             import function com.mycompany.helpers.MyHelperClass.SOME_FUNCTION;<br><br>             global com.emycompany.helpers.MyHelperClass helper;       <br>
<br>This solution is not ideal, because you relay on java classes (code outside of the rules and RETE) to perform evaluations (functions with evals in conditions) and<br>the consequence hide some code in java classes, which is not so good because one of the main features of a rule engine is the separation of the logic from the<br>
static code... but it works and it helps sometimes.<br><br>Good luck. <br>    <br><br><div class="gmail_quote">On Wed, Mar 23, 2011 at 7:55 AM, Adhir Mehta <span dir="ltr">&lt;<a href="mailto:adhirmehta21@gmail.com">adhirmehta21@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Thanks for the reply.<div><br></div><div>I think I was not up to the point. Modifying facts re-executes the rules to maintain the truth. In my case, I want to pass the data between the rules and also do not want rules to execute again. I know if no-loop option is specified, it will not be re-executed however I do not want rule engine to even go &amp; check for no-loop option (which is additional work).</div>

<div><br></div><div>I may be wrong as I am new to drools.</div><div><br></div><div>Thanks,</div><div>Adhir<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Mar 23, 2011 at 11:48 AM, Mark Proctor <span dir="ltr">&lt;<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

  
    
  
  <div text="#000000" bgcolor="#ffffff"><div>
    On 23/03/2011 05:46, Adhir Mehta wrote:
    <blockquote type="cite">Hi,
      <div><br>
      </div>
      <div>I have written the rule DRL file having around 30 rules in
        it. Some of the rules do intermediate calculation and those
        calculation result is expected in the other rules in same DRL
        file. I can do this by modifying the facts objects in one rule
        and get the value in other rule. However, modifying the facts
        object rebuild the RETE tree and affects the performance. Is
        there any way by which I can pass the data across the rules in
        same DRL file without rebuilding the RETE tree. (I am more
        concerned about the performance)</div>
    </blockquote></div>
    Please continue this conversation on the USER mailing list<br>
    <a href="http://www.jboss.org/drools/lists.html" target="_blank">http://www.jboss.org/drools/lists.html</a><br>
    <br>
    Modifying facts does not rebuild the rete. Adding/Removing rules
    causes changes to Rete tree.<br>
    <blockquote type="cite">
      <div><br>
      </div>
      <div>Thanks,</div>
      <div>Adhir</div>
      <pre><fieldset></fieldset>
_______________________________________________
rules-dev mailing list
<a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org" target="_blank">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
rules-dev mailing list<br>
<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-----------------------------<br>Felipe Piccolini<br><a href="mailto:felipe.piccolini@gmail.com">felipe.piccolini@gmail.com</a><br>