:CLEAR

Use the :CLEAR script statement to reset a previously populated script array to its initial values. This statement deletes all existing values, returning the array to the exact state it was in immediately after its original declaration. For more information about declaring arrays, see :DEFINE.

Note: The :CLEAR statement only deletes the contents of the array; it does not delete the variable itself, nor does it allow you to redefine the array's size or data type.

Syntax

:CLEAR Script array

Parameters

Parameter Description
Script array

Variable name of the script array to reset. You must specify the name of the script array with empty index brackets [].

Format: script variable

Examples

The following example defines and fills an array with the values from a line in a static VARA object. The values are printed in the activation report. Subsequently, the array is emptied and filled with values from a different line. The new values are also printed in 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