I want to build a excel decision table to implement the logic described as the following drl script:
======
global pricebook.PricingResult result;
rule "pricing"
when
$so : SalesOrder( customer.name=="customer1", from == "location1", to =="location2")
$sol : SalesOrderLine($sol.count >= 0, $sol.count < 100) from $so.lines
then
result.setPricingMode("A");
result.setUnitPrice(300.0f);
end
======
The java model for the script above is something like this:
======
class SalesOrder{
...
List<SalesOrderLine> lines;
...
}
======
In the excel decision table, I defined variables with the following text in excel cells:
======
$so : SalesOrder
$sol : SalesOrderLine ( ) from so.lines
...
======
The CONDITION column is defined as : $sol.count >= $1, $sol.count < $2
The decision table is translated into the following drl script:
global pricebook.PricingResult result;
rule "pricing"
when
$so : SalesOrder( customer.name=="customer1", from == "location1", to =="location2")
$sol : SalesOrderLine from $so.lines($sol.count >= 0, $sol.count < 100)
then
result.setPricingMode("A");
result.setUnitPrice(300.0f);
end
We can see that "$soi : SalesOrderLine ( ) from so.lines" in the excel decision table is translated into "$sol : SalesOrderLine from $so.lines($sol.count >= 0, $sol.count < 100)" instead of "$sol : SalesOrderLine($sol.count >= 0, $sol.count < 100) from $so.lines", which causes an error.
My question is, how to write the variable definition of SalesOrderLine in excel so that drools can translate it into something like "$sol : SalesOrderLine($sol.count >= 0, $sol.count < 100) from $so.lines " ?
Any ideas?
Thanks in advance...