Hi All !
I am trying use global variable in DRL file but when I am using it, gives
Exception. Please have a look at the DRL file -----
package com.drools.rules
import com.drools.facts.*;
*global CSVBeanAgent csvAgent;* [here I have declared the Global variable]
rule "Calculating Agent APE"
salience 35
no-loop true
when
$csvPolicy : CSVBeanPolicy()
//$csvAgent : CSVBeanAgent()
then
System.out.println("For agent --->zzzzz in rule setting premium form
rate>>>>"+$csvPolicy.getPremiumMode());
double policyAPE=$csvPolicy.getPolicyAPE();
System.out.println("policyAPE>>>>>"+policyAPE);
*System.out.println("Agent
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz>>>>>"+csvAgent);*
double agentAPE=0.0;
if(csvAgent.getAgentNo()==$csvPolicy.getAgentNo()){
System.out.println("inside if");
agentAPE=agentAPE+policyAPE;
}
csvAgent.setAgentAPE(agentAPE);
System.out.println("AgentAPE>>>>>>>>>>>>>>>"+csvAgent.getAgentAPE());
update($csvPolicy);
end
Above is my rule....the Bold one is I am trying to the value of *csvAgent*,
it gives *null* value. Please help me in finding the solution i.e. How to
declare the global variable and how to use it in DRL file.
Thanks !
--
View this message in context:
http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp401...
Sent from the Drools: User forum mailing list archive at
Nabble.com.