You can insert each Item as a fact. Or you can use the from keyword:<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">       rule &#39;some rule&#39;</span></div>

<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><meta http-equiv="content-type" content="text/html; charset=utf-8">       when</span></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">         $D:Data()</span></div>

<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">         $R:Item(item ==&quot;I1&quot;) from $D.items  //items should be populated at this point.<br>

       then<br>         System.out.println(&quot;hello&quot;);</span></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">       end</span></div>

<div><br></div><div>Please note that Data class will need a getter for items. Also note that items should be populated before insert Data as Fact.<div><br></div><div>Best Regards,<br clear="all"><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>

<br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>


<br><br><div class="gmail_quote">On Wed, Dec 29, 2010 at 10:07 AM, wasim.khan318 <span dir="ltr">&lt;<a href="mailto:khanwasim07@yahoo.co.in">khanwasim07@yahoo.co.in</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<br>
public static class Item<br>
        {<br>
private String CustomerId;<br>
private String Item;<br>
}<br>
<br>
public static class Data<br>
{<br>
        public ArrayList&lt;Item&gt; items = new ArrayList&lt;Item&gt;();<br>
<br>
        public ArrayList&lt;Item&gt;  GetData()<br>
        {Item item1 = new Item();<br>
// some code<br>
from database<br>
item1.CustomerId=rs.getString(&quot;CustomerId&quot;);<br>
  item1.Price=rs.getString(&quot;item&quot;);<br>
                   items.add(item);<br>
return item1<br>
}<br>
1.how to write rule how to find customer of a perticular Item<br>
2. what i have written<br>
 $D:Data();<br>
                $I:Item();<br>
<br>
<br>
          $R:Item(item ==&quot;I1&quot;  )from $D.GetData() ;<br>
<br>
<br>
        then<br>
        System.out.println(&quot;hello&quot;);<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/working-with-arraylist-in-drools-application-jboss-tp2162690p2162690.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/working-with-arraylist-in-drools-application-jboss-tp2162690p2162690.html</a><br>


Sent from the Drools - User mailing list archive at Nabble.com.<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>
</font></blockquote></div><br></div></div>