Hi,
See forall element in Drools manual:
5.8.3.6.1. Conditional Element forall
It does exactly what you describe. For the record, you may want to insert
all your line items separately to working memory.
Kind regards,
Frank
aliosha79 wrote
Hi,
i'm Alessio and i'm new in this forum. I'm learning to use drool in this
period and i'm facing a problem.
Briefly:
1- i have an xml document with a repeated element i.e.:
<order>
<orderLine>
<lineItem>
<name>item1</name>
<quantity>35</quantity>
</lineItem>
<orderline>
<orderLine>
<lineItem>
<name>item2</name>
<quantity>65</quantity>
</lineItem>
<orderline>
<orderLine>
<lineItem>
<name>item3</name>
<quantity>52</quantity>
</lineItem>
<orderline>
<priority>Normal</priority>
</order>
2- i marshalled it in a java class named "OrderType" using jaxb library
3- then i want to apply a rule stating: /IF EVERY LINEITEM QUANTITY IS
GREATER THAN 2
THEN SET PRIORITY TO HIGH/
i can access every single order line Element using this rule:
when
$Order : OrderType($Order.OrderLine[0].LineItem.Quantity.Value > 2)
then
$Order.getUBLRuleEnginePriority().setValue("High");
$Order.addApplyedRule("hpRule");
end
But how can i cycle on each of them writing the rule at point 3?
Thanks a lot.
Aliosha
--
View this message in context:
http://drools.46999.n3.nabble.com/Loop-Drools-on-Multi-Element-tp3761638p...
Sent from the Drools: User forum mailing list archive at
Nabble.com.