Let's say you have this method in a java class:
public void addOne(int number){
number = number +1;
}
And let's say you want to invoke that method from another method in the
same (or a different. It doesn't matter) object:
int number = 0;
this.addOne(number);
System.out.println("Number= "+number);
What is the output of the code above? Figure out that and you will figure
out what is happening with your global.
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Blog @
http://ilesteban.wordpress.com
On Mon, Jul 16, 2012 at 11:53 AM, abhinay_agarwal <
abhinay_agarwal(a)infosys.com> wrote:
global java.lang.Integer count
rule "rule1"
agenda-group "1"
when
//smething
then
count=0;
System.out.println(count); // output is 0
count = count +1;
System.out.println(count); // output is 1
drools.setFocus("2");
end
rule "rule2"
agenda-group "2"
when
//smething
then
System.out.println(count); // output is 0
end
in the rule2, the value of the global variable "count" must be 1, why m i
getting it as zero ?
--
View this message in context:
http://drools.46999.n3.nabble.com/Simple-Global-Error-tp4018697.html
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users