[rules-users] working with aray list

Michael Anstis michael.anstis at gmail.com
Thu Dec 30 13:35:24 EST 2010


If you want to keep your solution entirely within rules you'll need your
Customers in WM too:-

rule "find customer"
when
$d : Data( )
Item( item == "I1", $id : customerId) from $d.getData()
$c : Customer( id == $id )
then
..
end

On 29 December 2010 09:44, wasim.khan318 <khanwasim07 at yahoo.co.in> wrote:

>
> public static class Item
>        {
> private String CustomerId;
> private String Item;
> }
>
> public static class Data
> {
>        public ArrayList<Item> items = new ArrayList<Item>();
>
>        public ArrayList<Item>  GetData()
>        {Item item1 = new Item();
> // some code
> from database
> item1.CustomerId=rs.getString("CustomerId");
>  item1.Price=rs.getString("item");
>                   items.add(item);
> return item1
> }
> 1.how to write rule how to find customer of a perticular Item
> 2. what i have written
>  $D:Data();
>                $I:Item();
>
>
>          $R:Item(item =="I1"  )from $D.GetData() ;
>
>
>        then
>        System.out.println("hello");
>
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/working-with-aray-list-tp2161994p2161994.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101230/9050a8dc/attachment.html 


More information about the rules-users mailing list