GET_PUBLISHED_VALUE

Use the GET_PUBLISHED_VALUE script function to retrieve the value of an object variable or PromptSet variable from a task.

Syntax

GET_PUBLISHED_VALUE (RunID, Variable name)

Parameters

Parameter Description Format
RunID Defines the RunID of the task. Script literal or script variable
Variable name

Defines the name of the object variable or PromptSet variable to retrieve, without the leading ampersand (&).

Note: You can retrieve arrays from checklist and checkbox PromptSet elements. Include empty square brackets ([]) at the end of the variable name when retrieving an array.

AE name

Important Considerations

Key considerations include:

  • Combine GET_PUBLISHED_VALUE with :SET to read the value of an object variable, a PromptSet variable, or an individual element in a PromptSet array.

  • Combine GET_PUBLISHED_VALUE with :FILL to read a complete PromptSet array.

  • If the requested variable cannot be found, GET_PUBLISHED_VALUE returns an empty or initialized value.

Return Codes

The GET_PUBLISHED_VALUE function returns the value of the requested object variable, PromptSet variable, or PromptSet array element.

Examples

The following example activates an object and reads the object variable &VARIABLE1# in the activated task.

:SET &RUNID# = ACTIVATE_UC_OBJECT(&OBJ#,WAIT)

:SET &VAR# = GET_PUBLISHED_VALUE(&RUNID#,VARIABLE1#)

:PRINT "&&VARIABLE1# = &VAR#"

The following example reads the PromptSet variable &CHECKLIST1#, which has been defined as an array. The script only retrieves the value of the first array element.

:SET &RUNID# = ACTIVATE_UC_OBJECT(&OBJ#,WAIT)

:SET &VAR# = GET_PUBLISHED_VALUE(&RUNID#,"CHECKLIST1#[1]")

:PRINT "&&CHECKLIST1#[1] = &VAR#"

The following example retrieves the complete PromptSet array from the activated task. The script prints the individual PromptSet element values in the activation report. If the PromptSet array exceeds the size of the script array, the system only stores the elements that fit.

:DEFINE &ARRAY#, string, 10

:SET &RUNID# = ACTIVATE_UC_OBJECT(&OBJ#,WAIT)

:FILL &ARRAY#[] = GET_PUBLISHED_VALUE(&RUNID#,"CHECKLIST1#[]")

:SET &LEN# = LENGTH(&ARRAY#[])

:SET &VAR# = 1

:WHILE &VAR# LE &LEN#

:PRINT "&&ARRAY#[&VAR#] = &ARRAY#[&VAR#]"

:SET &VAR# = &VAR# + 1

:ENDWHILE

Related Topics

See also:

seealso

:FILL