COMSafeArray.From array 1

Syntax:

New COMSafeArray(<Array>, <ElementType>, <,...,>)

Parameters:

<Array> (required)

Type: Array.
An array is the data source for a COMSafeArray.

<ElementType> (required)

Type: String.
Defines the element type for a COMSafeArray.

<,...,> (optional)

Type: Number.
The number of elements in COMSafeArray each dimension, beginning with the first.
  • <size0> gives the number of elements in the null, first, dimension COMSafeArray
  • <size1> gives the number of elements in the first dimension, if the COMSafeArrayis more than two-dimensional;
etc. The total number of parameters must the same as the number of dimensions in the COMSafeArray.

Description:

Creates a COMSafeArray containing a given type of element from those in the array.
COMSafeArray element values are selected from the array given in the <ElementType> parameter, based on the following rules:
  • Each value of the first index of a COMSafeArray defines its slice with a dimension number decremented by 1.
  • For each value of the first index in a COMSafeArray, a corresponding value is selected from the array, and the COMSafeArray slice is initialized with this value. If there is not a value with the corresponding index in the array, the slice COMSafeArrayis initialized with a value of type Undefined.
This continues until the slice has no more elements COMSafeArray.
If the slice is not an element, and the array element is not an array, it is treated as an array with length 1.
If the dimensions for the COMSafeArrayare given, the constructed COMSafeArray will have those dimensions. If the dimensions are not given, they are defined by the maximum array index and the maximum array nesting level.

Example:

//Create a two-dimensional COMSafeArray with VT_I4 //element type, consisting of 2 rows and 3 columns.
//Receive elements values from the array.

Array1 = New Array;
// Filling the Array1 array with values
// ...
Array2 = New COMSafeArray(Array1, "VT_I4", 2, 3);


    

1C:Enterprise Developer's Community