Script statement: Stores several values to a script array.
:FILL 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. You can use the script function GET_PROCESS_LINE or GET_VAR for this purpose. |
This script function can be used to store several values to a script array at a time. Arrays must be created using :DEFINE. An array size must be specified because otherwise you cannot assign values. You can use the script function GET_PROCESS_LINE, STR_SPLIT or GET_VAR for this purpose. 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.
In order to pass arrays between subordinate or superordinate objects :PUBLISH must be used.
The first example uses GET_VAR in order to store the values of a Variable 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:
Script Element | Description |
---|---|
:PUBLISH | Defines script variables and arrays as object variables. |
Retrieves the current line content of a data sequence. |
|
GET_VAR | Returns the content of a Variable object. |
FIND | Searches through a script array and returns the corresponding index. |
LENGTH | Retrieves the size of a script array. |
Script Elements - Data Sequences
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function