<div dir="ltr"><div><div><div><div>So right now I have this:<br><br></div>$teach1 : Teacher($level : Level, $rosters1 : Rosters)<br><br></div><div>$roster1 : Roster($subject : Subject) from $rosters1<br></div><div><br></div>
$teachs : ArrayList () from collect ( Teacher(Level == $level) )<br><br></div>Teacher($rosters2 : Rosters) from $teachs<br><br></div>$rosts : ArrayList() from collect ( $roster2 : Roster(Subject != $subject) from $rosters2)<br>
<div><div><div><br></div><div>I am trying to make a list of all the rosters for different subjects at the same grade level, however I am only getting rosters for 1 teacher at a time. I realize this is most likely due to the 2nd to last line but I&#39;m not sure how to get around that. Any thoughts are helpful.<br>
</div><div><br><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 11, 2013 at 1:44 PM, Stephen Masters <span dir="ltr">&lt;<a href="mailto:stephen.masters@me.com" target="_blank">stephen.masters@me.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Look up &quot;Conditional Element collect&quot; in the manual. That provides example code for getting a list of matching facts.</div>
<div><br></div><div>For more complex tasks, there&#39;s &quot;accumulate&quot;.</div><div><br></div><div>Steve</div><div><div class="h5"><div><br></div><br><div><div>On 11 Apr 2013, at 17:51, Alex Burman &lt;<a href="mailto:alexburman@gmail.com" target="_blank">alexburman@gmail.com</a>&gt; wrote:</div>
<br><blockquote type="cite"><div dir="ltr"><div>Continuing with this same example, How can I count the number of times a student has received an A across all the classes?<br><br></div>I can get it to trigger each time a student appears in the rosters of 2 different teachers and that student has an A in both but I can&#39;t figure out how to track it across more then that. <br>

<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 5, 2013 at 4:50 AM, Stephen Masters <span dir="ltr">&lt;<a href="mailto:stephen.masters@me.com" target="_blank">stephen.masters@me.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Just thought I&#39;d mention that I hadn&#39;t replied to this, because it looks way too much like comp-sci homework. Not sure whether that&#39;s the same reason others haven&#39;t replied either. ;)<br>


<br>
A hint though to get you started. You can probably use something like...<br>
<br>
$student: Student(grade != null) from $roster<br>
<br>
… with a few lines before that to pick out the roster in a similar fashion.<br>
<br>
To understand it, check out the Drools Expert manual for the &quot;from&quot; operator for working with lists/collections.<br>
<br>
Steve<br>
<div><div><br>
<br>
On 3 Apr 2013, at 19:59, burmanator &lt;<a href="mailto:alexburman@gmail.com" target="_blank">alexburman@gmail.com</a>&gt; wrote:<br>
<br>
&gt; So the example I am working with is this:<br>
&gt; You have a Teacher object<br>
&gt;     that stores a list of Rosters  objects<br>
&gt;           in each Roster is a list of Students objects<br>
&gt;                each Student has a grade value<br>
&gt;<br>
&gt; How would I go about creating a rule to find all the students that got As<br>
&gt; for a given Teacher across all her Rosters?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; View this message in context: <a href="http://drools.46999.n3.nabble.com/creating-a-rule-regarding-an-element-of-list-stored-in-an-object-in-a-list-tp4023205.html" target="_blank">http://drools.46999.n3.nabble.com/creating-a-rule-regarding-an-element-of-list-stored-in-an-object-in-a-list-tp4023205.html</a><br>


&gt; Sent from the Drools: User forum mailing list archive at <a href="http://Nabble.com" target="_blank">Nabble.com</a>.<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></blockquote></div><br><br clear="all"><br>-- <br>Sincerely,<br>Alex Burman<br>cell: <a href="tel:908-672-0198" value="+19086720198" target="_blank">908-672-0198</a>
</div></div></div>
_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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></blockquote>
</div><br></div></div></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></blockquote></div><br><br clear="all"><br>-- <br>Sincerely,<br>Alex Burman<br>cell: 908-672-0198
</div>