[rules-dev] globals

fanory sgohory at club-internet.fr
Tue Feb 27 16:30:48 EST 2007


Hello,

My problem is to use a global variable in some rules:

global PhysicalPerson assignee

rule "get_the_assignee"
	no-loop
	salience 100
	when
		exists PhysicalPerson()		
		beneficiary : PhysicalPerson()
		eval(true)
	then
		assignee = new PhysicalPerson();
		assignee.setId(new Long(007));
		Tools2.traceSomething(assignee.getId());
		Tools2.traceSomething("get_the_assignee");
end

rule "check_the_assignee"
	no-loop
	salience 50
	when
		exists PhysicalPerson()		
		eval(true)
	then
		Tools2.traceSomething("check_the_assignee");
		Tools2.traceSomething(assignee.getId());
end

I don't understand why when my rule "check_the_assignee" is executed, i get a
null pointer exception on Tools2.traceSomething(assignee.getId()) ?
The question behind this is i want to use a created object inside a rule and use
it in others rules with lower salience ...

Thanks in advance.




More information about the rules-dev mailing list