The manual says "It is strongly discouraged to set or change a global value 
from inside your rules..." but it doesn't say it won't work.

I tried this:

========================
global Integer m;

declare DoneInit end

rule "init"
when
then
        insert(new DoneInit());
        System.out.println("m from Java: " + m);
        m = 100;
        System.out.println("m modified in init: " + m);
end

rule "use it"
when
        DoneInit()
then
        System.out.println("use m: " + m);
end
==========================

and got this output:

m from Java: 13
m modified in init: 100
use m: 13

Is this the expected behavior?  I'm in a stateless session in case that matters.


_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to