<br> 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.<br> Example:<br><br>rule "Calculates Memory Usage"<br>when
<br> $mpw: Resource( type=="MemoryInfo", attributes.Percent == null, $phys:attributes.PhysicalUsed, $tot: attributes.TotalPhysical )<br>then<br> $mpw.setAttribute( "Percent", ((Double)$phys).doubleValue() / ((Double)$tot).doubleValue());
<br> update( $mpw );<br>end<br><br>rule "High Average Usage"<br>when <br> Resource( type=="MemoryInfo", attributes.Percent > .95 )<br>then<br> // do something<br>end<br> <br>rule "Medium Average Usage"
<br>
when <br>
Resource( type=="MemoryInfo", attributes.Percent > .50 && <= .95 )<br>
then<br>
// do something<br>
end<br>
<br> Hope it helps...<br><br> []s<br> Edson<br><br><br><br><div><span class="gmail_quote">2007/8/27, cfili <<a href="mailto:cfilippelli@cerner.com">cfilippelli@cerner.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Sure... basically using a map called "attributes" to retrieve specific<br>attributes on a resource. Currently I am simply printing the value from the<br>eval, but I would like to be able to store it.<br><br>
rule "High Memory 95%"<br><br> when<br> $mpw : Resource(type == "MemoryInfo", $physUsed :<br>attributes["PhysicalUsed"], $totalPhys : attributes["TotalPhysical"])
<br> eval((((Double)$physUsed).doubleValue() /<br>((Double)$totalPhys).doubleValue()) > 0.95)<br> then<br> System.out.println(" Percent Used: " + ((Double)$physUsed).doubleValue() /
<br>((Double)$totalPhys).doubleValue());<br>end<br>--<br>View this message in context: <a href="http://www.nabble.com/Storing-temp-results-in-eval-block-tf4225783.html#a12354084">http://www.nabble.com/Storing-temp-results-in-eval-block-tf4225783.html#a12354084
</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br><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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli
<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>