If you want to keep your solution entirely within rules you'll need your Customers in WM too:-<br><br>rule "find customer"<br>when<br>$d : Data( )<br>Item( item == "I1", $id : customerId) from $d.getData()<br>
$c : Customer( id == $id )<br>then<br>..<br>end<br><br><div class="gmail_quote">On 29 December 2010 09:44, wasim.khan318 <span dir="ltr"><<a href="mailto:khanwasim07@yahoo.co.in">khanwasim07@yahoo.co.in</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); 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<Item> items = new ArrayList<Item>();<br>
<br>
public ArrayList<Item> GetData()<br>
{Item item1 = new Item();<br>
// some code<br>
from database<br>
item1.CustomerId=rs.getString("CustomerId");<br>
item1.Price=rs.getString("item");<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 =="I1" )from $D.GetData() ;<br>
<br>
<br>
then<br>
System.out.println("hello");<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-aray-list-tp2161994p2161994.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/working-with-aray-list-tp2161994p2161994.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>