Examples: Inheriting Object Variables
The examples in this topic describe how variables are inherited from parents to children:
- Example: Activating a File Transfer By a Schedule
- Example: Inheriting Values in Children and Grand Children
- Example: A Combination of Inheritance Features
Example: Activating a File Transfer By a Schedule
A File Transfer is activated by a Schedule. The following object variables are involved:
Schedule:
- &FILE# = Close_of_week.txt
- &HOST# = win01
File transfer:
- &FILE# = Close_of_day.txt
- &PATH# = C:\Temp
The script of the File Transfer accesses the variables defined in the Schedule (&FILE#, &HOST# and &PATH#). Their values depend on what is selected in the Settings section on the Variables Page of the Schedule.
Inherit from parent |
Variable content |
Explanation |
---|---|---|
All values (default) |
&FILE# = Close_of_week.txt |
The schedule's value overwrites the file transfer's value. |
&HOST# = win01 |
All the schedule's values are inherited. Therefore, the file transfer can also access &HOST#. |
|
&PATH# = C:\Temp |
This object variable is already part of the file transfer. |
|
Only defined values |
&FILE# = Close_of_week.txt |
The schedule's value overwrites the file transfer's value because it also contains the object variable &FILE#. |
&HOST# = "" |
The value of &HOST# is not inherited because the file transfer does not contain an object variable of the same name. Task activation is canceled if an attempt is made to access a non-existing or non-inherited object variable via script. |
|
&PATH# = C:\Temp |
This object variable is already part of the file transfer. |
|
No values |
&FILE# = Close_of_day.txt |
No values are inherited. Therefore, the file transfer's object variable is used. |
&HOST# = "" |
The value of &HOST# is not inherited. Therefore, it cannot be used. Task activation is canceled if an attempt is made to access a non-existing or non-inherited object variable via script. |
|
&PATH# = C:\Temp |
This object variable is already part of the file transfer. |
Example: Inheriting Values in Children and Grand Children
This example shows how values are inherited in a child workflow and beyond.
The workflow PARENTWF01 includes the objects FILETRANSFER01 and WORKFLOW01. WORKFLOW01 includes two jobs. Value inheritance between the main workflow and the file transfer is as explained in example 1.
Parent | Children | Grandchildren |
---|---|---|
PARENTWF01 Object variables: |
FILETRANSFER01 Object variable: |
N/A |
WORKFLOW01 Object variable: |
JOB02 | |
JOB03 Object variable: |
Different situations are shown below and describe how WORKFLOW01 and its settings affect the two jobs:
- In all objects, the setting "All values (default)" has been defined.
Object variables are always inherited to the corresponding child task. JOB03 can access the object variables of WORKFLOW01, as well as those of the main workflow. Therefore, &FOLDER# can be used in the job. FILETRANSFER01 obtains the object variables of the main workflow but not the ones of the other objects because they are not its parents. - WORKFLOW01 has the setting "Only defined values". WORKFLOW01 does not inherit the object variable &FOLDER#. Therefore, the other two jobs cannot access its values because values are only passed on from a task to its direct child task.
- JOB03 has the setting "No values".
The job's script does not inherit object variables. Its script remains unaffected and &HOST# obtains value "unix03".
Example: A Combination of Inheritance Features
The following example includes the various combinations and special features of the inheritance of object and PromptSet variables.
Five tasks run in a workflow (tasks 1, 2, 3, 4 and 6) and are executed one after the other. Task 5 is activated by using the script of task 4.
The workflow includes the object variables &VAR1#, &VAR2# and the PromptSet variables &TEXT1#, &COMBO1#.
- Task 1: No variables are inherited because of the setting "Inherit from parent - No variables".
- Task 2: Only includes variables that have been defined in the object itself. Only &VAR2# is inherited and set to the value JOBP2.
- Task 3: Inherits all the workflow's variables.
- Task 4: All parent variables except for &COMBO1# are inherited. The reason is the PromptSet variables of the same name are not overwritten.
The script element :PSET is used to pass the object variable &VAR3# on to the workflow. It is then available for subsequent workflow tasks.
Task 5 is activated by using the script (ACTIVATE_UC_OBJECT) and the variables are passed on PASS_VALUES). - Task 5: Includes only variables that have been defined in the object.
&VAR1# is set to the value "JOBP1" and &TEXT1# is set to "text" (workflow value). - Task 6: The next workflow task inherits all the workflow's variables including &VAR3#. This variable has been passed on to the workflow by task 4.
See also: