REDIM

REDIM

REDIM action


Function

Resizes (number of rows) the local structured variable or object of the Structured variable type.

Declaration

REDIM rec [newDim]

Parameters

rec

out

Name of the local structured variable or object of the Structured variable type or type ALIAS.

newDim

in

Expression of the Int type - new size (number of rows).

Description

The resizing (number of rows) does not bring the loss of values in items which existed before an action (enlarging of an array).
It holds for value of the local structured variable that new items are initialized on invalid value and minimal number of rows (newDim) is 0 (zero).
If it happens that there is a deficiency of memory during the change of structured variable size, the action will cause the calling of a script proceeding and will generate the error ERR_RANGE_ERROR with the description. The value of variable will not be changed.

It holds for value of object the Structured variable type that all attributes of new items are configured as Inherited (start value, limits, ...). The minimal size is 1.
The resize of the object Structured variable is intervention to the configuration (it is done in the D2000 Server process and its result is saved into configuration database). A time of change of object configuration is a present time.
Action REDIM failed (because of abort when the script is executed) when the object is opened to be edited (when the script is aborted the variable _ERR_NR_TRANS_EX, that characterized the error in detail, is set).

Example 1

Copying values from the object SV.Structure into the local variable of the RECORD type.

 

; variable declaration RECORD NOALIAS (SD.RecordDef) _locRec ; resizing the array (number of rows) REDIM _locRec[SV.Structure\DIM] ; copying a value SET _locRec WITH SV.Structure

Example 2

Resizing of the object Structured variable:

 

; declaration of type ALIAS ALIAS (SD._System_Redundancy) _aList ; pointing it on object SV._System_Redundancy SET _aList AS SV._System_Redundancy ; resize to 10 REDIM _aList[10] ;other way - resize to 5 REDIM SV._System_Redundancy[5]

Related pages:

Script actions