REDIM action


Function
Resizes (number of rows) the local structured variable or object of Structured variable type.
Declaration
 REDIM rec [newDim]

Parameters
rec out Name of the local structured variable or object of Structured variable type or type ALIAS.
newDim in Expression of Int type - new size (number of rows).

Description
The resizing (number of rows) does not bring the loss of values in items that existed before an action (enlarging of an array).
It holds for value of local structured variable that new items are initialized on invalid value and minimal number of rows (newDim) is 0 (zero).
If it happen that there is a deficiency of memory during the change of structured variable size, the action will cause the abort of 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 Structured variable type that all attributes of new items are configured as Inherited (start value, limits, ...). Minimal size is 1.
The resize of the object Structured variable is intervention to the configuration (it is done in process D2000 Server 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 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 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:

Napíšte komentár