:FILL

Use the :FILL script statement to store several values in a script array at a time. Before you can do that, you must create an array with the :DEFINE script statement where you also define the array size or the number of elements. For more information, see :DEFINE and Arrays.

Note: Use :PUBLISH to pass arrays on to subordinate or superordinate objects.

Syntax

:F[ILL] script array = values

Parameters

  • :FILL
    Stores several values to a script array

  • Script array
    Name of the script variable that is defined as an array. Use empty square brackets [] to indicate the script array in this parameter.

  • Values
    Values that should be stored in the array. If the number of values that should be stored exceeds the size of the array, only the first values are stored until the array's size is complete. All other values remain unchanged if the array is larger than the retrieved values.
    Format: script function

    Tip: You can use the following script elements to assign values where the returned values are written to the array starting with the first element (index=1):

Example

The first example defines the array and then uses the GET_VAR script function in the :FILL statement to store the values of a VARA object in the array. In the :PRINT statement, you define that you want to print the second value of the KEY1 key by including the number 2 in the square brackets [2].

:DEFINE &ARRAY#, string, 20
:FILL &ARRAY#[] = GET_VAR(VARA.TEST, KEY1)
:PRINT "The second value of the KEY1 key in the VARA.TEST variable is &ARRAY#[2]"

The second example creates the columns of a log file's first line (Automation Engine) in the array.

:DEFINE &ARRAY#, string, 20
:SET &HND# = PREP_PROCESS_FILE(WIN01, "C:\AUTOMIC\AUTOMATIONENGINE\TEMP\CPsrv_log_001_00.txt","*","COL=LENGTH","LENGTH_TAB='8=DATE,1,6=TIME,7,200=TEXT'")
:PROCESS &HND#
:FILL &ARRAY#[] = GET_PROCESS_LINE(&HND#)

:ENDPROCESS

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

:WHILE &RUNVAR# LE &LEN#
:P "Line &RUNVAR#: &ARRAY#[&RUNVAR#]"
:SET &RUNVAR# = &RUNVAR# + 1
:ENDWHILE  

See also: