These are some of the differences between variables and globals:
Best Regards,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


On Wed, Apr 13, 2011 at 8:39 AM, gs76pl <gstasica@pacemetrics.com> wrote:
hi,

this seems like a basic question i should know the answer to after reading
some documentation but unfortunately after doing some tests with
onExitActions there seems to be some discrepancy between what doc reads and
how the process/action behaves. Could anyone verify my observations:

1. while documentation in "4.4. Data" reads "...Actions can access variables
directly, simply by using the name of the variable as a parameter name" in
fact this is INCORRECT as at that point actions expect a global object to be
in the session!! e.g. below code in onExitAction throws an exception if
tracker obj hasn't been defined as a global variable and entered into the
session (it doesn't matter that the process has tracker variable defined)

tracker.addVisitedNode("dasdf");

2. the only way of accessing process variables is via context object as
below

context.getVariable("tracker")

3. inserting/updating object in the session can be done
a) context.getKnowledgeRuntime().insert("myFact");
b) insert("myFact");

looks like there is no difference here and the second one is simple a
shorter version of doing the same



--
View this message in context: http://drools.46999.n3.nabble.com/what-is-the-difference-between-process-variable-global-variables-tp2815658p2815658.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