Script Statement: Resets a script array to its initial values.
:CLEAR Script Array
Syntax |
Description/Format |
---|---|
Script Array |
The variable name of the script array that should be reset. |
You can use this script statement to reset a script array that has already been used to its initial values. All the existing values will be deleted in this case and the array is reset to the original status that it obtained directly after its declaration (:DEFINE).
The array must be specified with the empty index brackets [].
This script element only deletes the content of the array, the variable will not be deleted. The effect is that you cannot redefine the array.
The following example defines an array and fills it with the values of a line that is part of a static Variable object. These values are then output in the activation report. Subsequently, the array is emptied and filled with the entry of another variable. The new values are also written to the activation report.
:DEFINE &ARRAY#, string, 5
:DEFINE &STR#, string
:FILL &ARRAY#[] = GET_VAR(VARA.STATIC.TEST,"KEY01")
:SET &STR# = ARRAY_2_STRING(&ARRAY#[])
:P "KEY01: &STR#"
:CLEAR &ARRAY#[]
:FILL &ARRAY#[] = GET_VAR(VARA.STATIC.TEST,"KEY02")
:SET &STR# = ARRAY_2_STRING(&ARRAY#[])
:P "KEY02: &STR#"
See also:
Script Elements | Description |
---|---|
Declares a script variable with a particular data type. |
Script Elements - Script Structure and Processing
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function