Very interesting. I tried it too , I dont think its about the '==' because it seems to be working for eval( reason == 'override'). So it is more to do with having the eval method call. <br>Nice find. Not too sure if this is a bug, or if there is a reason why drools works this way.<br>
<br><br>Thanks<br><br>Jai <br><br><div class="gmail_quote">On Feb 7, 2008 5:43 PM, ST <<a href="mailto:super_thunder2@hotmail.com">super_thunder2@hotmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I got it working by using the inline eval expression. The following is the<br>modified version of the rules.<br><div class="Ih2E3d"><br>rule "Remove smaller or non-overriden"<br> dialect "java"<br>
when<br> L : Response( $r : value && status != "override" )<br></div> Response( value > $r || eval (status.equals("override")) )<br> then<br> System.out.println("Retracting " + L);<br>
retract( L );<br>end<br><br>The Response class has two fields one is value and the other is status. For<br>convenience, I added a constructor where the first parameter is the value and<br>the second is the status. I have added the following objects into the working<br>
memory for testing.<br><br> final Response response1 = new Response(5,"override");<br> final Response response2 = new Response(6,"not override");<br> final Response response3 = new Response(7,"not override");<br>
final Response response4 = new Response(8,"not override");<br> session.insert( response1 );<br> session.insert( response2 );<br> session.insert( response3 );<br> session.insert( response4 );<br>
<br> session.fireAllRules();<br><br>The result shows that the object, Response(5,"override"), is the only one left<br>after the all activated rules have been evaluated.<br><br>I am not sure why "==" does not work in this example. Is this a known bug?<br>
<div><div></div><div class="Wj3C7c"><br><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>