<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 &lt;marcus.ilgner@gmail.com&gt;<br>To: Rules Users List &lt;rules-users@lists.jboss.org&gt;<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 &lt;<a ymailto="mailto:boxwala@yahoo.com" href="mailto:boxwala@yahoo.com">boxwala@yahoo.com</a>&gt; wrote:<br>&gt; I have the following class structure.<br>&gt;<br>&gt; Class GrandFather {<br>&gt;&nbsp;  List&lt;Father&gt; fathers;<br>&gt;&nbsp;  public List&lt;Father&gt; getFathers() {return fathers;}<br>&gt; }<br>&gt;<br>&gt; Class Father {<br>&gt;&nbsp; &nbsp; int age;<br>&gt;&nbsp;  List&lt;Son&gt; sons;<br>&gt;&nbsp;  public int getAge() {return age;}<br>&gt;&nbsp;  public List&lt;Son&gt; getSons() {return sons;}<br>&gt; }<br>&gt;<br>&gt; Class Son {<br>&gt;&nbsp; int age;<br>&gt;&nbsp;  public int getAge() {return age;}<br>&gt; }<br>&gt;<br>&gt; I'd like to write a rule that finds all the Fathers who have age &gt; 45 and<br>&gt; have Sons where the son's age is greater than 5. But I can't figure out how<br>&gt; to use "from" to iterate over father first and then over son.<br>&gt;<br>&gt;
 Any help will be greatly appreciated.<br>&gt;<br>&gt; Thanks,<br>&gt; --Aziz<br><br>Something like this?<br><br>rule "FatherAndSon<br>when<br>&nbsp; $father : Father(age &gt; 45)<br>&nbsp; $son : Son(age &gt; 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>