<br>   Chris,<br><br>   Not sure what you mean. If you want to know what is in there for debug purposes, I guess the best way is to implement your own average() accumulate function that prints out (or do whatever you want) with the bound variables/facts.<br>
<br>   For regular use, it does not makes sense to allow access to such variable because it is bound to multiple values. For instance:<br><br>$tot : Number() from accumulate( <br>    Order( $value : value ),<br>    sum( $value ) )<br>
<br>    This pattern will sum all the values from all the Order facts in the working memory. Lets imagine that it would be possible to access the $value variable outside the accumulate, what Order would it be bound to? So, it makes no sense...<br>
<br>     []s<br>     Edson<br><br><div class="gmail_quote">2009/6/17 Chris Richmond <span dir="ltr">&lt;<a href="mailto:crichmond@referentia.com">crichmond@referentia.com</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 link="blue" vlink="blue" lang="EN-US">

<div>

<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">So how can I access variables that I have
populated from within that scope delimiter(accumulate)?  For instance if I did
want to access the delayTime, what strategy should be used?</span></font></p>

<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks,</span></font></p>

<p><font color="navy" size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"><br>
Chris</span></font></p>

<div>

<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr align="center" size="3" width="100%">

</span></font></div>

<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;">
<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><span style="font-weight: bold;">On
Behalf Of </span></b>Edson Tirelli<br>
<b><span style="font-weight: bold;">Sent:</span></b> Wednesday, June 17, 2009
11:49 AM<br>
<b><span style="font-weight: bold;">To:</span></b> Rules Users List<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users]
averages on different data types</span></font></p>

</div><div><div></div><div class="h5">

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
   Chris,<br>
<br>
   Remember that accumulate is a scope delimiter, meaning variables
bound inside accumulate are not visible outside of it. The error message you
see is the MVEL way of saying: non-existing variable (I guess you are using
mvel as the dialect for the consequence).<br>
<br>
   If you want to know what data objects are being inserted/expired
from the working memory, use a working memory listener.<br>
<br>
   []s<br>
   Edson</span></font></p>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">2009/6/17 Chris Richmond &lt;<a href="mailto:crichmond@referentia.com" target="_blank">crichmond@referentia.com</a>&gt;</span></font></p>

<div link="blue" vlink="purple">

<div>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Hi
guys,</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Building
from the stockticker sample, I have been running my own average aggregates over
time and window length and I have the following rule…it simply runs a last 10
average and outputs the average(in theory). </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">rule
&quot;show averages&quot;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">when</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   
        $n : Number( doubleValue &gt; 0 )
from accumulate (</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">           
$mdo : MyDataObject($tm: delayTime) over window:length(10) from entry-point
&quot;DataObject stream&quot;,</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">           
average( $tm )</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
)</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">then</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   
System.err.println($tm);</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">End</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I
have set the limit to 0 for the average because I simply want to have it fire
every time, no matter the average(they are all positive)</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">However
I get this error:</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Unable
to build expression for &#39;consequence&#39;: Failed to compile: 1 compilation
error(s): </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> -
(1,3) unqualified type in strict mode for: $tm &#39;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">   
System.err.println($tm);</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">&#39; :
[Rule name=&#39;show averages&#39;]</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">If
I have the consequence </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">System.err.println($n);</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Then
it outputs the average no problem, but I am trying to simply output that
indifidual value, delayTime which I have stored in $tm is an integer, so I
cannot figure out why I cannot output this value.    Similarly
if I simply try as a consequence:</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">System.err.println($
mdo.delayTime);</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">I
get a similar error.</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">What
am I doing wrong?</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Thanks,</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"><br>
<font color="#888888"><span style="color: rgb(136, 136, 136);">Chris</span></font></span></font></p>

</div>

</div>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 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></span></font></p>

</div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
<br clear="all">
<br>
-- <br>
 Edson Tirelli<br>
 JBoss Drools Core Development<br>
 JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a></span></font></p>

</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><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>