<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16705" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>&gt; If I try to set variable that hasn't been declared in the ruleflow 
header - the variables section. I get following error:<BR>&gt; "Could not find 
variable someVariableName<BR>&gt; Continuing without setting value"</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>
<DIV><FONT face=Arial size=2>Actually, the problem here is&nbsp;not that you 
cannot set the value of a variable that is not defined in the process.&nbsp; It 
is possible to simply set the value of a variable on a variable context 
instance, even if the variable has not been defined.&nbsp; The problem here 
however is that variable contexts can be nested: a composite node can define a 
sub-context, where the variables defined in this context are only accessible 
from inside that composite node.&nbsp; Whenever you try to set the value of a 
variable, I must first search for the right variable scope.&nbsp; This searching 
is based on the definition of these variables.&nbsp; At this point, if it cannot 
find the variable, it simply does not set the value.&nbsp; There are however 
other option:</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp; - set the value on the top-level context 
(i.e. process-level variables)</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp; - set the value on the lowest-level context 
(the most deeply nested container)</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp; - allow the user to specify the 
context</FONT></DIV>
<DIV><FONT face=Arial size=2>I think I might change the default behaviour to 
setting the value on the process-level scope, as that is how I already do it 
when getting the value of a variable.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>You can also manually select the scope yourself in 
your action, e.g. setting to the process-level scope can be done 
using:</FONT></DIV>
<DIV><FONT face=Arial size=2>((VariableScopeInstance) 
(context.getProcessInstance().getContextInstance(VariableScope.VARIABLE_SCOPE))).setVariable("name", 
value);</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Of course, a Util class could hide these internal 
structures for you.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Kris</FONT></DIV></DIV></BODY></HTML>