Restarts & variables/values

Discussion created by daryl.brown_ACI on May 20, 2013
Latest reply on May 21, 2013 by Darren_Sniezak_40
I apparently have some confusion over how restarts work with respect to the variables they have access to.

For instance, I have one workflow that contains a nested workflow at the very end.  This nested workflow inherits the value of a filename -- &FILENAME# -- runs it through a reformatter, and then redefines &FILENAME# using PSET, before then transferring that file elsewhere.  The issue I've run into is that if this nested workflow fails after I've already redefined &FILENAME#, I've now completely lost the original value in that variable.  The intent, of course, would be to just restart this reformatter workflow, but without that original filename value, it now fails in other places.

So, in an effort to be really clever, I added &ORIG_FILENAME# to the nested workflow's Variables & Prompts tab (wtih a blank value), and added this code to the process tab:

:if sys_act_restart() = "Y"
!  restore the original value of this filename
:  set &filename# = &orig_filename#
!  save this inherited (original) filename in case we need to do a restart
:  set &orig_filename# = &filename#

Now when I run this nested workflow through normally, I can see that it has set &ORIG_FILENAME# properly.  But if I go and do a restart on this nested workflow, it has now completely lost track of &ORIG_FILENAME#, and &FILENAME# gets set to ' '.

So...can someone help me understand why this is happening, or point out where the flaw is in my logic?
Is there any way to perform a restart that forces all of the variables back to their original values from when the workflow/task was first run?  (I had thought this was the point of providing a Reference RunID, but apparently not.)