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

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: All values (default)

    • &FILE# = Close_of_week.txt

      The Schedule value overwrites the File Transfer value

    • &HOST#  = win01

      All the Schedule values are inherited. Therefore, the File Transfer can also access &HOST#

    • &PATH# = C:\Temp

      This object variable is already part of the File Transfer

  • Inherit from parent: Only defined values

    • &FILE# = Close_of_week.txt

      The Schedule value overwrites the File Transfer 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.

  • Inherit from parent: No values

    • &FILE# = Close_of_day.txt

      No values are inherited. Therefore, the File Transfer 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.

A Workflow called PARENTWF01 includes two objects: FILETRANSFER01 and WORKFLOW01. WORKFLOW01 includes two Jobs.

Value inheritance between the main Workflow and the File Transfer is as explained in example 1.

Graphic explaining how variables are inherited.

Depending on which option you select in WORKFLOW01, the two Jobs are affected in the following different ways:

  • All values (default) is defined in all objects

    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.

  • Only defined values is defined in WORKFLOW01

    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.

  • No values is defined in JOB03

    The script in the Job 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.

Variables page

See also: