<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Is your inline eval() time-constant? I would guess that &quot;howOld()&quot; is returning different values when executed at different times. Inline evals MUST be time-constant. Top level evals can deal with non-time-constant expressions.<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; []s<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/12/10 Bagwell, Allen F <span dir="ltr">&lt;<a href="mailto:afbagwe@sandia.gov">afbagwe@sandia.gov</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">







<div>
<font size="3" face="Arial, sans-serif">
<div>&nbsp;</div>
<div><font size="2">I&#39;m puzzled over the proper use of in-line evals.&nbsp; I&#39;ve used them successfully in some places. But it seems that on occasion something doesn&#39;t work when I think it should.</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2">First, this is a when clause that works properly using a separate eval statement. The rule activates and fires when expected:</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2" face="Courier New">$rt : RuleTimer(uniqueName == &quot;Hardware Status Request&quot;, timedOut == true)</font></div>
<div><font size="2" face="Courier New">$hw : Hardware($activelyMonitored : activelyMonitored, command == null)</font></div>
<div><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AttrBoolean(this == $activelyMonitored, currentValue == true) </font></div>
<div><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eval($hw.getStatusRequested().howOld() &gt; $hw.getStatusPeriod())</font></div>
<div><font size="2" face="Courier New">&nbsp;</font></div>
<div><font size="2" face="Courier New">&nbsp;</font></div>
<div><font size="2">However, this re-write changing to an in-line eval never fires.</font></div>
<div><font size="2">&nbsp;</font></div>
<div><font size="2" face="Courier New">$rt : RuleTimer(uniqueName == &quot;Hardware Status Request&quot;, timedOut == true)</font></div>
<div><font size="2" face="Courier New">$hw : Hardware($activelyMonitored : activelyMonitored, command == null, eval(statusRequested.howOld() &gt; statusPeriod) )</font></div>
<div><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AttrBoolean(this == $activelyMonitored, currentValue == true)</font></div>
<div><font size="2" face="Courier New">&nbsp;</font></div>
<div><font size="2" face="Arial, sans-serif">Likewise, this re-write doesn&#39;t fire either where I sought to bind the more complex statusRequested object to a Drools variable before using it in the eval. The field statusPeriod just holds a primitive double.</font></div>

<div><font size="2" face="Arial, sans-serif">&nbsp;</font></div>
<div><font size="2" face="Courier New">$rt : RuleTimer(uniqueName == &quot;Hardware Status Request&quot;, timedOut == true)</font></div>
<div><font size="2" face="Courier New">$hw : Hardware($activelyMonitored : activelyMonitored, $sr : statusRequested, command == null, </font></div>
<div><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eval($sr.howOld() &gt; statusPeriod) )</font></div>
<div><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AttrBoolean(this == $activelyMonitored, currentValue == true)</font></div>
<div><font size="2" face="Courier New">&nbsp;</font></div>
<div><font size="2" face="Arial, sans-serif">I haven&#39;t been able to find anything in the manual that says these other two syntaxes are wrong. Furthermore, the Drools compiler has no issues with them.</font></div>
<div><font size="2" face="Arial, sans-serif">&nbsp;</font></div>
<div><font size="2" face="Arial, sans-serif">Thanks!</font></div>
<div><font size="2" face="Arial, sans-serif">&nbsp;</font></div>
<div><font color="#008080" size="2" face="Tahoma, sans-serif">Allen F. Bagwell</font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">e-mail:&nbsp; <a href="mailto:afbagwe@sandia.gov" target="_blank">afbagwe@sandia.gov</a></font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">phone:&nbsp; 505/284-4517</font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">fax:&nbsp; 505/ 844-7886</font></div>
<div><font color="#008080" size="1" face="Tahoma, sans-serif">&nbsp;</font></div>
<div style="margin-top: 5pt; margin-bottom: 5pt;"><font color="#008080" size="1" face="Tahoma, sans-serif">Ask your doctor if medical advice from a TV commercial is right for you.</font></div>
<div><font size="1" face="Tahoma, sans-serif">&nbsp;</font></div>
<div><font size="1" face="Tahoma, sans-serif">&nbsp;</font></div>
<div><font size="2">&nbsp;</font></div>
</font>
</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><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>