Hi again! sorry for the delay, I have been out of the office. Thanks all for
the answers. The function I tried to use on my spreadsheet was:
function boolean isInRange(Date date, int months){
Date minDate = new Date();
Date maxDate = Utils.addMonthsToDate(minDate, months);
if((Utils.compareTo(minDate, date) == Utils.EQUAL ||
Utils.compareTo(minDate, date) == Utils.LOWER) && (Utils.compareTo(maxDate,
date) == Utils.EQUAL || Utils.compareTo(maxDate, date) == Utils.GREATER))
return true;
else return false;
}
Utils is a static class I imported from my java classes. From the table
rules:
CONDITION
customer:Customer()
eval(isInRange(customer.setContractEndDate(),$param))
And the trace:
org.drools.RuntimeDroolsException: Exception executing predicate
es.tid.tesco.ur.dataprocessing.ruleengine.rules.Rule_ContractDate_12_0Predicate0Invoker@53028588
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:279)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)
at
org.drools.impl.StatelessKnowledgeSessionImpl.execute(StatelessKnowledgeSessionImpl.java:300)
at
es.tid.tesco.ur.dataprocessing.ruleengine.impl.RuleEngineUpgradeImpl.execute(RuleEngineUpgradeImpl.java:64)
at ...
Some suggestion? Thanks again.
--
View this message in context:
http://drools.46999.n3.nabble.com/SPREADSHEET-DECISION-TABLE-Can-I-use-fu...
Sent from the Drools: User forum mailing list archive at
Nabble.com.