:PUBLISH

Use the :PUBLISH script statement to convert script variables and arrays into object variables. The :PUBLISH script statement is similar to the :PSET statement in that both script statements can pass object variables to parent tasks. :PUBLISH and :PSET differ in the following ways:

  • You can convert arrays to object variables with :PUBLISH.
  • :PSET creates script variables if they do not already exist. :PUBLISH does not create script variables, so you need to make sure that any script variables you call in your :PUBLISH statements already exist, or use the :SET statement to create them.

Syntax

:PUB[LISH] Variable name [, [Object variable] [,Scope] ]

Parameters

  • :PUBLISH
    Converts the script variable or script array to an object variable

  • Variable name
    Name of the script variable or script array to convert
    Format: script variable
    Follow the rules for variable names. For more information, see Variable Names.
    For arrays, include empty brackets [] at the end of the name.

  • Object variable
    Name of the new object variable, without a leading ampersand (&)
    Format: AE name
    For arrays, do not specify the empty index brackets at the end of the variable name.

  • Scope
    Specifies the tasks within which the variable can be used
    Allowed values:

    • TASK
      The object variable is only available for its own task.
    • WORKFLOW
      The object variable is passed on to the parent Workflow.
    • TOP
      The object variable is passed on to the top Workflow.

Important!

  • The script variable or array that you specify must already exist. A runtime error occurs if the specified script variable or array does not exist yet.
  • Performance may suffer if you use a script array with very many (10,000 or more) elements.

Notes:

  • Arrays are published with their filled size for performance reasons.
    Examples
    An array is empty (all entries have an assigned null string). Nothing is published.
    A different array has 5 entries. The last 2 entries are null strings. Only the first 3 entries are published to subsequent tasks. The size of the array in the subsequent task is limited to 3.
  • Empty elements at the end of an array are not used in or removed from the object variable, even if you convert the script variable or create a new object variable.

Examples

In the following example, the SYS_ACT_ME_NAME function retrieves the object name and stores it in a script variable called &CHILD#. The :PUBLISH statement includes the WORKFLOW parameter so that the parent workflow can also use the script variable.

:SET &CHILD# = SYS_ACT_ME_NAME()
:PUBLISH &CHILD#,,"WORKFLOW"

The following example defines a script array and fills it with values from a VARA object. The array is passed on to the top workflow as an object variable.

:DEFINE &ARRAY#, string, 5
:FILL &ARRAY#[] = GET_VAR(VARA.TEST, KEY1)

:PUBLISH &ARRAY#[], VARA_ARRAY#, "TOP"

See also: