What I would do in your case is to have 2+ rules. One rule calculates the value, and the other(s) rule(s) will reason over the calculated value.
    Example:

rule "Calculates Memory Usage"
when
     $mpw: Resource( type=="MemoryInfo", attributes.Percent == null, $phys:attributes.PhysicalUsed, $tot: attributes.TotalPhysical )
then
     $mpw.setAttribute( "Percent", ((Double)$phys).doubleValue() / ((Double)$tot).doubleValue());
     update( $mpw );
end

rule "High Average Usage"
when
    Resource( type=="MemoryInfo", attributes.Percent > .95 )
then
    // do something
end
 
rule "Medium Average Usage"
when
    Resource( type=="MemoryInfo", attributes.Percent > .50 && <= .95 )
then
    // do something
end
 
    Hope it helps...

     []s
     Edson



2007/8/27, cfili <cfilippelli@cerner.com>:

Sure... basically using a map called "attributes" to retrieve specific
attributes on a resource.  Currently I am simply printing the value from the
eval, but I would like to be able to store it.

rule "High Memory 95%"

        when
                $mpw : Resource(type == "MemoryInfo", $physUsed :
attributes["PhysicalUsed"], $totalPhys : attributes["TotalPhysical"])
                eval((((Double)$physUsed).doubleValue() /
((Double)$totalPhys).doubleValue()) > 0.95)
        then
                System.out.println(" Percent Used: " + ((Double)$physUsed).doubleValue() /
((Double)$totalPhys).doubleValue());
end
--
View this message in context: http://www.nabble.com/Storing-temp-results-in-eval-block-tf4225783.html#a12354084
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com