I have simple rule in which, I want to use external java function which returns integer value. And I want to use this return value in rule LHS for comparison.
rule "testRuleBTW"
when
$cfd : FactsData()
condition : RuleData( ageCondition != null,
ageCondition.value1 != null,
ageCondition.value2 != null,
"BTW" == ageCondition.conditionCode,
$returnValue : Utils.foo($cfd.dateOfBirth, ageCondition.ageUnitCode) //Want to use this value in next c
ageCondition.value1 <= $returnValue, $returnValue <= ageCondition.value2)
then
//do something
But getting below error
java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=com/test/rules/ageRule.drl, line=13, column=0 text=[ERR 101] Line 13:42 no viable alternative at input '$cfd' in rule "testRuleBTW"], Message [id=2, level=ERROR, path=com/test/rules/ageRule.drll, line=0, column=0 text=Parser returned a null Package]] at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:433) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:587) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:558) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5223) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)