<div dir="ltr"><br>&nbsp;&nbsp; Hey Aziz, <br><br>&nbsp; Try like this:<br><br>when<br>&nbsp;&nbsp;&nbsp; $f : Father( age &gt; 45 )<br>&nbsp;&nbsp;&nbsp; exists( Son( age &gt; 5 ) from $f.sons )<br>then<br>&nbsp;&nbsp; // $f is older than 45 and has at least one son older than 5<br>
end<br><br>&nbsp;&nbsp; Happy drooling,<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><br><div class="gmail_quote">2008/7/17 Aziz Boxwala &lt;<a href="mailto:boxwala@yahoo.com">boxwala@yahoo.com</a>&gt;:<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>&nbsp; List&lt;Father&gt; fathers;<br>&nbsp; public List&lt;Father&gt; getFathers() {return fathers;}<br>
}<br><br>Class Father {<br>&nbsp;&nbsp; int age;<br>&nbsp; List&lt;Son&gt; sons;<br>&nbsp; public int getAge() {return age;}<br>&nbsp; public List&lt;Son&gt; getSons() {return sons;}<br>}<br><br>Class Son {<br>&nbsp;int age;<br>&nbsp; public int getAge() {return age;}<br>
}<br><br>I&#39;d like to write a rule that finds all the Fathers who have age &gt; 45 and have Sons where the son&#39;s age is greater than 5. But I can&#39;t figure out how to use &quot;from&quot; 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>