Christine_Chavez_6412

How to override the Variable Object in a ForEach Workflow during runtime

Discussion created by Christine_Chavez_6412 on May 10, 2016
There are a couple of options to do this.

One option is: on ForEach Workflow, make sure that "Generate at runtime" is checked and set "Variable Object" to &VARA#.

Create a PromptSet. This is where you will input the variable name during runtime.

Then, create a parent workflow, add the promptset that you created to "variables&prompts" of the parent workflow, and add the ForEach Workflow as a task.

On the Parent Workflow:
1) Make sure that "Generate at runtime"  is checked
2) on Process tab:

:print textfield &TEXTFIELD1#
:pset &VARA# = &TEXTFIELD1#  

Note that &TEXTFIELD1# is the variable from your promptset, and &VARA# is the variable on "variable object" on ForEach workflow.


Another option is: on ForEach Workflow, make sure that "Generate at runtime" is checked and set "Variable Object" to &VARA#.

Create a script (SCRI) or job that will activate the ForEach wofkflow. In the example below, a script assigns a value to &VARA# and then activate the ForEach workflow while passing the value.

:set &vara2# = 'VARA.FE.02'
:pset &vara# = &vara2#
:set &act# = activate_uc_Object(JOBP.FOREACH,,,,,PASS_VALUES)
:print act = &act#

Note:
You can change the script above to store multiple VARA in an array, loop through the array (:WHILE), and for each iteration activate the ForEach workflow (where it will use the VARA that was passed).  

Outcomes