GET_SCRIPT_VAR

Use the GET_SCRIPT_VAR script function to query the values of different script variables without writing multiple conditional statements. This function uses a placeholder to return the values of script variables indirectly. You do not need to set the names of the script variables directly in your script as the placeholder acts as a variable. The function lets you query the values of multiple variables with a single script line, and is useful in processing loops. The placeholder that you define is a string that contains the name of one or more variables whose values you want to return

The script function retrieves values from the following types of objects:

  • VARA objects
  • Object variables
  • PromptSet variables

Syntax

GET_SCRIPT_VAR (Script variable)

Parameters

  • GET_SCRIPT_VAR
    Returns values of script variablesFormat: AE name, script literal or script variable

  • Script variable
    Placeholder for the names of script variables to return
    Format: AE name, script literal or script variable
    Notes:

    • Do not start the placeholder with an ampersand (&), as the ampersand is used for variable names.
    • Follow the other rules for naming variables. For more information, see Variable Names.
    • You must pass on the exact variable name, as otherwise the script fails.

Important!

  • If the script variable cannot be uniquely identified, the system reads the value of the first applicable variable.
  • The variable name is searched as of the & or the next character. If the string you specify does not match the initial characters of any variable name, an error occurs.

Example

This example uses a script in a Job to retrieve names and values from a VARA object that is called SCRIPT_VARA. The script prints the retrieved names in the activation report. Assume that the VARA object contains the following script variable names:

  • End#
  • Start#
  • Ultimo#

Write the following script in the Job:

:SET &END#    = "20051027"
:
SET &START#  = "20051024"
:
SET &ULTIMO# = "20051031"  

:
SET &HANDLE# = PREP_PROCESS_VAR("SCRIPT_VARA")    

:
PROCESS &HANDLE#
:   
SET &VARIABLE# = GET_PROCESS_LINE(&HANDLE#,1)
:   
SET &VALUE# = GET_SCRIPT_VAR(&VARIABLE#)
:   
PRINT  "&VARIABLE# = &VALUE#"
:
ENDPROCESS

:
CLOSE_PROCESS &HANDLE#

Where:

  • :SET

    Assigns a value to a script variable

  • PREP_PROCESS_VAR

    Retrieves a list of values from a VARA object

    The retrieved values are provided as a data sequence for further internal processing.

  • :PROCESS ... :ENDPROCESS
    Defines a loop for line-by-line processing of a data sequence

  • GET_PROCESS_LINE
    Retrieves the content of the current line in a data sequence

  • GET_SCRIPT_VAR
    Retrieves values for multiple script variables

  • :PRINT
    Prints lines to the activation report

  • :CLOSE_PROCESS
    Discards a data sequence within a script

The script reads the script variable names from the VARA object. The variable name is passed to a script variable called &VALUE#. A :PRINT statement uses the variable &VALUE# to write the values for END#, &START# and &ULTIMO# to the activation report.

The following lines are written to the activation report:

2005-02-03 12:51:23 - U0020408 End = 20051027
2005-02-03 12:51:23 - U0020408 Start = 20051024
2005-02-03 12:51:23 - U0020408 Ultimo = 20051031

See also: