: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 number of elements. The values are written to the array starting with the first element (index = 1). 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 statement. -
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:
Example
The first example uses GET_VAR to store the values of a VARA object to the array.
:DEFINE &ARRAY#, string, 20
:FILL &ARRAY#[] = GET_VAR(VARA.TEST, KEY1)
:PRINT "First value of the variable VARA.TEST, key KEY1: &ARRAY#[1]"
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: