:FILL
Script statement: Stores several values to a script array.
Syntax
:F[ILL] script array = values
Syntax |
Description/Format |
---|---|
Script array |
Name of the script variable that has been defined as an array. Use the square brackets without content. |
Values |
Values that should be stored to the array. Tip: You can use the following script elements to assign values: |
This script function can be used to store several values to a script array at a time.
Use the :DEFINE script statement to create the array. Specify the array size, as you cannot assign values otherwise. For more information, see :DEFINE and Arrays.
The values are written to the array starting with the first element (index = 1).
If the number of values that should be stored exceeds the array's capacity, only the first values are stored until the capacity is used to its full. If the array is larger than the retrieved values, all other values remain unchanged.
Use empty square brackets [] in order to indicate the script array in this function.
Note: In order to pass arrays between subordinate or superordinate objects :PUBLISH must be used.
Example
The first example uses GET_VAR in order 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:
seealso