<div dir="ltr"><br> Hey Aziz, <br><br> Try like this:<br><br>when<br> $f : Father( age > 45 )<br> exists( Son( age > 5 ) from $f.sons )<br>then<br> // $f is older than 45 and has at least one son older than 5<br>
end<br><br> Happy drooling,<br><br> []s<br> Edson<br><br><br><div class="gmail_quote">2008/7/17 Aziz Boxwala <<a href="mailto:boxwala@yahoo.com">boxwala@yahoo.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>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 have Sons where the son's age is greater than 5. But I can't figure out how 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></div></div><br>
</div><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>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>
</div>