How do I set a global in Drools 4 from within a rule? I want to set a boolean if a rule fires so that it can read it from another rule with a lower salience.
A:
Assuming you're using Drools 5.x, you can do this in your rule consequence:
kcontext.getKnowledgeRuntime().setGlobal(name, value);
Kris Verlaenen
2009-11-30 18:40:53
Sorry I forgot to mention it is Drools 4
Tarski
2009-12-01 09:43:08
A:
You might be able to do something like:
drools.getWorkingMemory().setGlobal... (similar to above, what kris said).
Michael Neale
2009-12-04 03:02:06