GET_PUBLISHED_VALUE
Script Function: Retrieves the value or PromptSet variable of a certain task.
Syntax
GET_PUBLISHED_VALUE (RunID, Variable name)
Syntax |
Description/Format |
---|---|
RunID | The running number (RunID) of the task. Format: script literal or script variable |
Variable Name |
The name of an object or PromptSet variable of the specified task (without a leading & character). Object Variables store values that can be used throughout an object. They are defined on the Variables page of an executable object or with the :PSET script statement. In arrays, you must additionally used empty brackets [] at the end of the name. |
Return codes |
---|
The value of the object or PromptSet variable. |
Comments
You can use this script function together with :SET and :FILL. The script statement :SET can read the value of a regular object or PromptSet variable or of an individual PromptSet array element and :FILL can read a complete PromptSet array.
You can only define PromptSet variables as arrays in checklist and checkbox elements.
Examples
The following example activates an object and then reads its object variable &VARIABLE1#.
:SET &RUNID# = ACTIVATE_UC_OBJECT(&OBJ#,WAIT)
:SET &VAR# = GET_PUBLISHED_VALUE(&RUNID#,VARIABLE1#)
:PRINT "&&VARIABLE1# = &VAR#"
The second example reads the PromptSet variable &CHECKLIST1# that has been defined as an array. Only the value of the first array element is read here.
:SET &RUNID# = ACTIVATE_UC_OBJECT(&OBJ#,WAIT)
:SET &VAR# = GET_PUBLISHED_VALUE(&RUNID#,"CHECKLIST1#[1]")
:PRINT "&&CHECKLIST1#[1] = &VAR#"
The following scenario retrieves the activated task's complete PromptSet array. Then, the individual PromptSet elements are output in the activation report. If the PromptSet array exceeds the size of the script array, the system only stores the elements that fit in.
: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
See also:
Script element | Description |
---|---|
Stores several values to a script array. |
|
:PUBLISH | Defines script variables and arrays as object variables. |
Script Elements - Activation Data
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Functions