Skip to main content
Version: 20 R7 BETA

COPY ARRAY

COPY ARRAY ( source ; destination )

ParameterTypeDescription
sourceArrayArray from which to copy
destinationArrayArray to which to copy

Description

The COPY ARRAY command creates or overwrites the destination array destination with the exact contents, size, and type of the source array source.In case of numeric arrays of different types, the type of the destination array is kept.

The source and destination arrays can be local, process, or interprocess arrays. When copying arrays, the scope of the array does not matter.

Notes:

  • In compiled mode, the destination array must be of the same type as the source array. Thus, it is recommended to always use arrays of the same type to have similar behavior in interpreted and compiled modes.
  • When you copy object arrays, only references to the objects that they contain are duplicated, and not objects themselves. It means that any modification done on an object in an array will be applied to all existing instances of the object in copied arrays. If you need to duplicate objects, you must use the OB Copy command.

Example

The following example fills the array named C. It then creates a new array, named D, of the same size as C and with the same contents:

 ALL RECORDS([People]) // Select all records in People
 SELECTION TO ARRAY([People]Company;C) // Move company field data into array C
 COPY ARRAY(C;D) // Copy the array C to the array D

Properties

Command number226
Thread safe