Hi,
I am having a problem in iterating a list inside a list.
I am having the following business scenario.
Public Class CustomerOrder {
private String customerName;
private ArrayList<Order> orderList;
}
Public Class Order {
private String orderId;
private String orderTime;
private ArrayList<OrderItem> orderList;
}
Public Class OrderItem {
private String itemName;
private Double itemAmount;
}
I need to find the total order amount for each order and the sum of all
order.
My rule is like individual orders should not exceed a 10000 and total order
amount of all customers should not exceed 100000.
For this, I need to iterate ArrayList<Order> orderList and during each
iteration , I need to iterate ArrayList<OrderItem> orderList. Is this
possible in Drools ?
I tried something like this. But it doesn't seem to be working.
when
ClaimRegistration($orderList: orderList)
Number( $count : intValue > 0)
from accumulate(Order(orderId== "order1"
&&
Number( doubleValue > 10000 )
from accumulate( OrderItem( $value : itemAmount),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
) from $orderList,count(1))
then
Sysout(",,,,,");
It would be of great help if any one can give suggestions to solve this.
Is nested loops possible in Drools ?
Regards,
Dinesh
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Is-nested-loops-possi...
Sent from the Drools - User mailing list archive at
Nabble.com.