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