<div dir="ltr"> <br> You can have a setup rule with high-salience or specific agenda-group (or whatever other flow
control mechanism you want) firing first and setting the values in its
consequence, but you MUST fire this rule before asserting your facts into the working memory, because I guess you will be using these globals in the LHS of other rules.<br><br> So the code of your application would be like:<br>
<br>* create rulebase<br>* create session<br>* set focus on "setup"<br>* fire setup rule<br>* assert facts<br>* fire rules<br><br> The setup rule would be like:<br><br>rule "setup rule"<br> agenda-group "setup"<br>
when<br>then<br> // set globals like this:<br> drools.getWorkingMemory().setGlobal( "myGlobal", someValue );<br>end<br><br> []s<br> Edson<br><br><br><br><div class="gmail_quote">2008/9/30 Gary Napier <span dir="ltr"><<a href="mailto:gnapier@cis.strath.ac.uk">gnapier@cis.strath.ac.uk</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi all,<br>
<br>
I have common code that can run a number of different rule base(s) and so far each of the different rule bases have utilized common Global variables (lists of regular expressions and runtime options)<br>
<br>
However a new rule base will require additional /different globals to be set and i do not want to change the code that invokes the engine and compiles the rule base.<br>
<br>
Is it possible, by way of an example, to have a rule execute upon rule base initialization and populate a series of global variables? Ideally this would come from a settings config file in the same directory as the<br>
rule .drl files.<br>
<br>
Thanks<br>
Gary<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>