BuiltIn.CreateVariantArray3 Method

Applies to TestComplete 15.46, last modified on January 09, 2023

Description

The CreateVariantArray3 method lets you create a new three-dimensional array whose elements will have the Variant type.

This method is available if the BuiltIn plugin is installed and enabled. The plugin is installed and enabled by default.

Declaration

BuiltIn.CreateVariantArray3(Low1, High1, Low2, High2, Low3, High3)

Low1 [in]    Required    Integer    
High1 [in]    Required    Integer    
Low2 [in]    Required    Integer    
High2 [in]    Required    Integer    
Low3 [in]    Required    Integer    
High3 [in]    Required    Integer    
Result Variant

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Low1

The lowest array index of the array's first dimension.

High1

The highest array index of the array's first dimension.

Low2

The lowest array index of the array's second dimension.

High2

The highest array index of the array's second dimension.

Low3

The lowest array index of the array's third dimension.

High3

The highest array index of the array's third dimension.

Result Value

The created array.

Remarks

The array format adopted in JavaScript, JScript, Python, C#Script and C++Script languages differs from the format of arrays created with this routine. In these scripting languages, arrays are objects, while the CreateVariantArray3 method produces variant arrays. The elements of variant arrays cannot be assigned directly from JavaScript, JScript, Python, C#Script or C++Script. TestComplete supports Python arrays, and there is no need to use variant arrays.

There was a workaround for one-dimensional arrays: an ordinary JavaScript or JScript array was created, filled with values and then converted to a variant array. See the Remarks section in the BuiltIn.CreateVariantArray topic for details. Unfortunately, this trick does not work for multidimensional arrays. This happens, because, in JavaScript and JScript, multidimensional arrays are emulated by arrays of arrays, thus the ConvertJScriptArray routine will return a one-dimensional array that contains other arrays as its items.

Example

VBScript

' Creates a three-dimensional array [0..1, 1..2, 2..3]
w = CreateVariantArray3(0, 1, 1, 2, 2, 3)
w(0,1,2) = "Element 0,1,2"
w(0,2,2) = "Element 0,2,2"
w(1,2,2) = "Element 1,2,2"
w(1,2,3) = "Element 1,2,3"

DelphiScript

// Creates a three-dimensional array [0..1, 1..2, 2..3]
w := CreateVariantArray3(0, 1, 1, 2, 2, 3);
w[0,1,2] := 'Element 0,1,2';
w[0,2,2] := 'Element 0,2,2';
w[1,2,2] := 'Element 1,2,2';
w[1,2,3] := 'Element 1,2,3';

See Also

BuiltIn.CreateVariantArray
BuiltIn.CreateVariantArray2
BuiltIn.VarArrayRedim
BuiltIn.VarArrayLowBound
BuiltIn.VarArrayHighBound

Highlight search results