<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div>Marcus,<br><br>Thank you very much. I am trying that out.<br><br>--Aziz<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">----- Original Message ----<br>From: Marcus Ilgner <marcus.ilgner@gmail.com><br>To: Rules Users List <rules-users@lists.jboss.org><br>Sent: Thursday, July 17, 2008 2:35:55 PM<br>Subject: Re: [rules-users] Using from<br><br>
Hi Aziz,<br><br>On Thu, Jul 17, 2008 at 8:26 PM, Aziz Boxwala <<a ymailto="mailto:boxwala@yahoo.com" href="mailto:boxwala@yahoo.com">boxwala@yahoo.com</a>> wrote:<br>> I have the following class structure.<br>><br>> Class GrandFather {<br>> List<Father> fathers;<br>> public List<Father> getFathers() {return fathers;}<br>> }<br>><br>> Class Father {<br>> int age;<br>> List<Son> sons;<br>> public int getAge() {return age;}<br>> public List<Son> getSons() {return sons;}<br>> }<br>><br>> Class Son {<br>> int age;<br>> public int getAge() {return age;}<br>> }<br>><br>> I'd like to write a rule that finds all the Fathers who have age > 45 and<br>> have Sons where the son's age is greater than 5. But I can't figure out how<br>> to use "from" to iterate over father first and then over son.<br>><br>>
Any help will be greatly appreciated.<br>><br>> Thanks,<br>> --Aziz<br><br>Something like this?<br><br>rule "FatherAndSon<br>when<br> $father : Father(age > 45)<br> $son : Son(age > 5) from $father.sons<br>then<br>// do something<br>end<br><br>Best regards<br>Marcus<br>_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" 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></div><br>
</body></html>