<div>Glad my hasty original reply has been ripped apart ;-)</div>
<div>&nbsp;</div>
<div>Goes to show that everybody has something new to learn.</div>
<div>&nbsp;</div>
<div>Thanks to everyone for the corrections (and simpler, correct,&nbsp;solution!).</div>
<div>&nbsp;</div>
<div>Mike<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 02/05/2008, <b class="gmail_sendername">mashup</b> &lt;<a href="mailto:richard.bremner.nb@googlemail.com">richard.bremner.nb@googlemail.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>Ahhh I wondered about that, thanks. Again, now I see it, it makes complete<br>sense. This drools stuff is actually pretty damn good!<br>
<br>Richard<br><br>Chris Woodrow wrote:<br>&gt;<br>&gt; You&#39;re right, if you want to do this with 2 facts, you&#39;ll need to do :<br>&gt;<br>&gt;&nbsp;&nbsp; $test : Test( $y : y )<br>&gt;&nbsp;&nbsp; Test(<br>&gt; this == $test,<br>&gt; x == ($y + 1) )<br>
&gt;<br>&gt; Chris<br>&gt;<br>&gt; 2008/5/2 Raffi Khatchadourian &lt;<a href="mailto:khatchad@cse.ohio-state.edu">khatchad@cse.ohio-state.edu</a>&gt;:<br>&gt;<br>&gt;&gt; On Fri&nbsp;&nbsp;2.May&#39;08 at 10:05:20 +0100, Anstis, Michael (M.) wrote:<br>
&gt;&gt;<br>&gt;&gt; &gt; The &quot;when&quot; section matches fact (object) patterns, so your requirement<br>&gt;&gt; &gt; could be written as:-<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; when there is a Test Fact &#39;A&#39; and another Test Fact &#39;B&#39; where &quot;the &#39;x&#39;<br>
&gt;&gt; &gt; property of &#39;A&#39;&quot; equals &quot;the &#39;y&#39; property of fact &#39;B&#39; plus 1&quot; then.....<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; This would become:-<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; rule &quot;Rule 1&quot;<br>
&gt;&gt; &gt; when<br>&gt;&gt; &gt;&nbsp;&nbsp; Test( $y : y )<br>&gt;&gt; &gt;&nbsp;&nbsp; Test( x == ($y + 1) )<br>&gt;&gt; &gt;<br>&gt;&gt;<br>&gt;&gt; Actually, please correct me if I am mistaken, but is this condition<br>&gt;&gt; correct? I believe that the original question is that for a single<br>
&gt;&gt; instance of class Test t, fire the rule when t.x == t.y + 1 (where &#39;t&#39;<br>&gt;&gt; refers to the *same* instance of class Test). I believe the rule above<br>&gt;&gt; would match any instance of class Test whose x value is equal to the<br>
&gt;&gt; value of the instance field y from *any* instance of class Test plus 1.<br>&gt;&gt; Does that make sense?<br>&gt;&gt; _______________________________________________<br>&gt;&gt; rules-users mailing list<br>&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>&gt;&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>&gt;<br>
&gt;<br><br>--<br>View this message in context: <a href="http://www.nabble.com/newbie-question-on-%22when%22-condition-syntax-tp17015309p17028019.html">http://www.nabble.com/newbie-question-on-%22when%22-condition-syntax-tp17015309p17028019.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<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>