Global "variables" aren't plain old Java variables; they are kept in a wrapped map. Functions are passed to a Java compiler "as is", with only the import list added to the compilation unit.
So you can use a global in a DRL function
I have a global defined and I am trying to use it from a function. When my
rule gets loaded into my knowledge base, I always get an error complaining
about the global not being resolved.
---- simplified snippet ----
global int x;
function void foo(int n) {
x = n;
}
------------------------------
I get this kind of error "Function Compilation error: foo (line:20) x can
not resolved".
Should this work?
TIA,
Bob
--
View this message in context: http://drools.46999.n3.nabble.com/Globals-from-functions-tp3186882p3186882.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users