<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3429" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=273571618-10122008><FONT face=Arial 
color=#0000ff size=2>That's probably it, but my mind is blanking on the 
definition of time-constant as it would apply here.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=273571618-10122008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=273571618-10122008><FONT face=Arial 
color=#0000ff size=2>howOld() is doing a simple calculation of the difference 
between the current time and the timestamp value that was set in statusRequested 
however many x seconds ago. So based on your feedback, I'm assuming the inline 
eval isn't seeing proper timestamp value since its last change. But the top-leve 
eval can.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=273571618-10122008><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=273571618-10122008><FONT face=Arial 
color=#0000ff size=2>-A</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Edson 
Tirelli<BR><B>Sent:</B> Wednesday, December 10, 2008 10:45 AM<BR><B>To:</B> 
Rules Users List<BR><B>Subject:</B> Re: [rules-users] Finicky eval 
statements<BR></FONT><BR></DIV>
<DIV></DIV><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Is your inline eval() 
time-constant? I would guess that "howOld()" 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="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
  <DIV><FONT face="Arial, sans-serif" size=3>
  <DIV>&nbsp;</DIV>
  <DIV><FONT size=2>I'm puzzled over the proper use of in-line evals.&nbsp; I've 
  used them successfully in some places. But it seems that on occasion something 
  doesn't work when I think it should.</FONT></DIV>
  <DIV><FONT size=2></FONT>&nbsp;</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></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=2>$rt : RuleTimer(uniqueName == "Hardware 
  Status Request", timedOut == true)</FONT></DIV>
  <DIV><FONT face="Courier New" size=2>$hw : Hardware($activelyMonitored : 
  activelyMonitored, command == null)</FONT></DIV>
  <DIV><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  AttrBoolean(this == $activelyMonitored, currentValue == true) </FONT></DIV>
  <DIV><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  eval($hw.getStatusRequested().howOld() &gt; 
$hw.getStatusPeriod())</FONT></DIV>
  <DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT size=2>However, this re-write changing to an in-line eval never 
  fires.</FONT></DIV>
  <DIV><FONT size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=2>$rt : RuleTimer(uniqueName == "Hardware 
  Status Request", timedOut == true)</FONT></DIV>
  <DIV><FONT face="Courier New" size=2>$hw : Hardware($activelyMonitored : 
  activelyMonitored, command == null, eval(statusRequested.howOld() &gt; 
  statusPeriod) )</FONT></DIV>
  <DIV><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  AttrBoolean(this == $activelyMonitored, currentValue == true)</FONT></DIV>
  <DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial, sans-serif" size=2>Likewise, this re-write doesn'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 face="Arial, sans-serif" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=2>$rt : RuleTimer(uniqueName == "Hardware 
  Status Request", timedOut == true)</FONT></DIV>
  <DIV><FONT face="Courier New" size=2>$hw : Hardware($activelyMonitored : 
  activelyMonitored, $sr : statusRequested, command == null, </FONT></DIV>
  <DIV><FONT face="Courier New" 
  size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  eval($sr.howOld() &gt; statusPeriod) )</FONT></DIV>
  <DIV><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  AttrBoolean(this == $activelyMonitored, currentValue == true)</FONT></DIV>
  <DIV><FONT face="Courier New" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial, sans-serif" size=2>I haven'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 face="Arial, sans-serif" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial, sans-serif" size=2>Thanks!</FONT></DIV>
  <DIV><FONT face="Arial, sans-serif" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Tahoma, sans-serif" color=#008080 size=2>Allen F. 
  Bagwell</FONT></DIV>
  <DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1>e-mail:&nbsp; <A 
  href="mailto:afbagwe@sandia.gov" 
  target=_blank>afbagwe@sandia.gov</A></FONT></DIV>
  <DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1>phone:&nbsp; 
  505/284-4517</FONT></DIV>
  <DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1>fax:&nbsp; 505/ 
  844-7886</FONT></DIV>
  <DIV><FONT face="Tahoma, sans-serif" color=#008080 size=1></FONT>&nbsp;</DIV>
  <DIV style="MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt"><FONT 
  face="Tahoma, sans-serif" color=#008080 size=1>Ask your doctor if medical 
  advice from a TV commercial is right for you.</FONT></DIV>
  <DIV><FONT face="Tahoma, sans-serif" size=1></FONT>&nbsp;</DIV>
  <DIV><FONT face="Tahoma, sans-serif" size=1></FONT>&nbsp;</DIV>
  <DIV><FONT 
  size=2></FONT>&nbsp;</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></BODY></HTML>