These are some of the differences between variables and globals:<div><ul><li>You can make inference about your globals using rules</li><li>Variables are persisted as part of the process instance info. Globals are not.</li>
<li>I didn't test it in every node type, but at least in Script Tasks, you can access process variables using just its name. </li></ul><div>Best Regards,</div><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>
- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
<br><br><div class="gmail_quote">On Wed, Apr 13, 2011 at 8:39 AM, gs76pl <span dir="ltr"><<a href="mailto:gstasica@pacemetrics.com">gstasica@pacemetrics.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
hi,<br>
<br>
this seems like a basic question i should know the answer to after reading<br>
some documentation but unfortunately after doing some tests with<br>
onExitActions there seems to be some discrepancy between what doc reads and<br>
how the process/action behaves. Could anyone verify my observations:<br>
<br>
1. while documentation in "4.4. Data" reads "...Actions can access variables<br>
directly, simply by using the name of the variable as a parameter name" in<br>
fact this is INCORRECT as at that point actions expect a global object to be<br>
in the session!! e.g. below code in onExitAction throws an exception if<br>
tracker obj hasn't been defined as a global variable and entered into the<br>
session (it doesn't matter that the process has tracker variable defined)<br>
<br>
tracker.addVisitedNode("dasdf");<br>
<br>
2. the only way of accessing process variables is via context object as<br>
below<br>
<br>
context.getVariable("tracker")<br>
<br>
3. inserting/updating object in the session can be done<br>
a) context.getKnowledgeRuntime().insert("myFact");<br>
b) insert("myFact");<br>
<br>
looks like there is no difference here and the second one is simple a<br>
shorter version of doing the same<br>
<font color="#888888"><br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/what-is-the-difference-between-process-variable-global-variables-tp2815658p2815658.html" target="_blank">http://drools.46999.n3.nabble.com/what-is-the-difference-between-process-variable-global-variables-tp2815658p2815658.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">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>
</font></blockquote></div><br></div>