<div>Glad my hasty original reply has been ripped apart ;-)</div>
<div> </div>
<div>Goes to show that everybody has something new to learn.</div>
<div> </div>
<div>Thanks to everyone for the corrections (and simpler, correct, solution!).</div>
<div> </div>
<div>Mike<br><br> </div>
<div><span class="gmail_quote">On 02/05/2008, <b class="gmail_sendername">mashup</b> <<a href="mailto:richard.bremner.nb@googlemail.com">richard.bremner.nb@googlemail.com</a>> 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>><br>> You're right, if you want to do this with 2 facts, you'll need to do :<br>><br>> $test : Test( $y : y )<br>> Test(<br>> this == $test,<br>> x == ($y + 1) )<br>
><br>> Chris<br>><br>> 2008/5/2 Raffi Khatchadourian <<a href="mailto:khatchad@cse.ohio-state.edu">khatchad@cse.ohio-state.edu</a>>:<br>><br>>> On Fri 2.May'08 at 10:05:20 +0100, Anstis, Michael (M.) wrote:<br>
>><br>>> > The "when" section matches fact (object) patterns, so your requirement<br>>> > could be written as:-<br>>> ><br>>> > when there is a Test Fact 'A' and another Test Fact 'B' where "the 'x'<br>
>> > property of 'A'" equals "the 'y' property of fact 'B' plus 1" then.....<br>>> ><br>>> > This would become:-<br>>> ><br>>> > rule "Rule 1"<br>
>> > when<br>>> > Test( $y : y )<br>>> > Test( x == ($y + 1) )<br>>> ><br>>><br>>> Actually, please correct me if I am mistaken, but is this condition<br>>> correct? I believe that the original question is that for a single<br>
>> instance of class Test t, fire the rule when t.x == t.y + 1 (where 't'<br>>> refers to the *same* instance of class Test). I believe the rule above<br>>> would match any instance of class Test whose x value is equal to the<br>
>> value of the instance field y from *any* instance of class Test plus 1.<br>>> Does that make sense?<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>>><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>><br>
><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>