Hi,
I have the following rules that I am trying to implement in a decision table
rule "Payment greater 5m"
agenda-group "txnPricing"
salience 5
when
payment : Collection() from bc.getPaymentTransactionTypes()
t : Transaction(customer == c,
transactionType memberOf payment,
transactionAmount >= 5000000)
then
t.setBaseFee(36.00);
t.setFeeDiscount(0.00);
end
rule "Payment less 5m"
agenda-group "txnPricing"
salience 5
when
payment : Collection() from bc.getPaymentTransactionTypes()
t : Transaction(customer == c,
transactionType memberOf payment,
transactionAmount < 5000000)
then
t.setBaseFee(60.00);
t.setFeeDiscount(0.00);
end
I have attached the Decision Table for reference. Basically, I have two
condition columns representing the 2 conditions respectively. When the
xls is processed the generated DSL has the two statements reversed as
indicated below, and hence the exceptions.
package za.co.fnb.billing;
#generated from Decision Table
import java.util.Collection;
import za.co.fnb.billing.Customer;
import za.co.fnb.billing.Transaction;
import za.co.fnb.billing.BillingConstraints;
global Customer c;
global BillingConstraints bc;
#From row number: 12
rule "Payments_12"
when
t: Transaction(customer == c, t.transactionAmount >= 0,
t.transactionAmount <5000000, transactionType memberOf $payments)
$payment : Collection() from
bc.getTransactionTypesForGroup("Payments")
then
t.setBaseFee(60.00);
t.setFeeDiscount(0.00);
end
#From row number: 13
rule "Payments_13"
when
t: Transaction(customer == c, t.transactionAmount >= 5000000,
t.transactionAmount <9999999999, transactionType memberOf $payments)
$payment : Collection() from
bc.getTransactionTypesForGroup("Payments")
then
t.setBaseFee(36.00);
t.setFeeDiscount(0.00);
end
org.drools.rule.InvalidRulePackage: Unable to return Declaration for
identifier '$payments' : [Rule name=Payments_12, agendaGroup=MAIN,
salience=0, no-loop=false]
Unable to create restriction '[VariableRestriction: memberOf $payments
]' for field 'transactionType' in the rule 'Payments_12' : [Rule
name=Payments_12, agendaGroup=MAIN, salience=0, no-loop=false]
Unable to return Declaration for identifier '$payments' : [Rule
name=Payments_13, agendaGroup=MAIN, salience=0, no-loop=false]
Unable to create restriction '[VariableRestriction: memberOf $payments
]' for field 'transactionType' in the rule 'Payments_13' : [Rule
name=Payments_13, agendaGroup=MAIN, salience=0, no-loop=false]
at org.drools.rule.Package.checkValidity(Package.java:424)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:384)
at
za.co.fnb.billing.TxnVolDecisionTableTest.readDecisionTable(TxnVolDecisionTableTest.java:164)
at
za.co.fnb.billing.TxnVolDecisionTableTest.executeExample(TxnVolDecisionTableTest.java:62)
at
za.co.fnb.billing.TxnVolDecisionTableTest.main(TxnVolDecisionTableTest.java:33)
Thanks,
Mike