:FILL

Use the :FILL script statement to populate a script array with multiple values simultaneously. Prior to using :FILL, you must define the array and its size (the number of elements) using the :DEFINE script statement. For more information, see :DEFINE and Arrays.

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

Syntax

:F[ILL] Script array = Values

Parameters

Parameter Description Format
Script array

Name of the script variable that is defined as an array. You must use empty square brackets [] to indicate the script array in this parameter.

Script variable
Values

Values that should be stored in the array. If the number of retrieved values exceeds the predefined size of the array, only the first values are stored until the array's capacity is reached. If the array is larger than the number of retrieved values, the remaining array elements are left unchanged.

Tip: You can use the following script functions to return multiple values. The returned values are written to the array starting with the first element (index = 1):

Script function

Examples

The first example defines an array and then uses the GET_VAR script function within the :FILL statement to store the values from a VARA object into the array. In the :PRINT statement, the number 2 is specified in the square brackets [2] to explicitly print the second value of the KEY1 key.

: 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