[rules-users] averages on different data types

Chris Richmond crichmond at referentia.com
Wed Jun 17 17:21:22 EDT 2009


Hi guys,

 

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). 

 

rule "show averages"

when

 

            $n : Number( doubleValue > 0 ) from accumulate (

 

 

 

            $mdo : MyDataObject($tm: delayTime) over window:length(10) from
entry-point "DataObject stream",

            average( $tm )

 

        )

 

 

then

 

    System.err.println($tm);

 

End

 

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)

 

 

However I get this error:

 

Unable to build expression for 'consequence': Failed to compile: 1
compilation error(s): 

 - (1,3) unqualified type in strict mode for: $tm '

    System.err.println($tm);

' : [Rule name='show averages']

 

 

If I have the consequence 

 

System.err.println($n);

 

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:

 

System.err.println($ mdo.delayTime);

 

I get a similar error.

 

What am I doing wrong?

 

Thanks,


Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090617/d4c75cd4/attachment.html 


More information about the rules-users mailing list