AddItemOfArrayType Method

Applies to TestComplete 15.69, last modified on November 13, 2024

The object-driven testing (ODT) functionality is deprecated. Do not use it to create new tests. It will be removed from the product in one of the future releases. As an alternative, you can create custom classes in your scripts. For more information, see Alternatives to the ODT functionality.

Description

The ArrayObject.AddItemOfArrayType method adds a new item to the end of the array. This new item will hold an array. The AddItemOfArrayType method returns the ArrayObject object that provides a scripting interface to this array.

Declaration

ArrayObjectObj.AddItemOfArrayType()

ArrayObjectObj An expression, variable or parameter that specifies a reference to an ArrayObject object
Result An ArrayObject object

Applies To

The method is applied to the following object:

Result Value

The new array item represented as an ArrayObject object.

Example

The code below adds a new MyProperty property of the array type to the specified class and then adds two new items to the created property.

JavaScript, JScript

function AddItemOfArrayType()
{
   // Specifies the object
   var Obj = ODT.Classes.MyClass;
   // Adds a property of the array type
   // to the specified object
   var Prop = Obj.AddPropOfArrayType("MyProperty");
   // Adds three items to the MyProperty array
   Prop.AddItemOfArrayType;
   Prop.AddItem(258);
   Prop.AddItem("MyString");
   // ...
}

VBScript

Sub AddItemOfArrayType
   ' Specifies the object
   Set Obj = ODT.Classes.MyClass
   ' Adds a property of the array type
   ' to the specified object
   Set Prop = Obj.AddPropOfArrayType("MyProperty")
   ' Adds three items to the MyProperty array
   Prop.AddItemOfArrayType
   Prop.AddItem(258)
   Prop.AddItem("MyString")
   ' ...
End Sub

DelphiScript

function AddItemOfArrayType;
var Obj, Prop;
begin
   // Specifies the object
   Obj := ODT.Classes.MyClass;
   // Adds a property of the array type
   // to the specified object
   Prop := Obj.AddPropOfArrayType('MyProperty');
   // Adds three items to the MyProperty array
   Prop.AddItemOfArrayType;
   Prop.AddItem(258);
   Prop.AddItem('MyString');
   // ...
end;

C++Script, C#Script

function AddItemOfArrayType()
{
   // Specifies the object
   var Obj = ODT["Classes"]["MyClass"];
   // Adds a property of the array type
   // to the specified object
   var Prop = Obj["AddPropOfArrayType"]("MyProperty");
   // Adds three items to the MyProperty array
   Prop["AddItemOfArrayType"];
   Prop["AddItem"](258);
   Prop["AddItem"]("MyString");
   // ...
}

See Also

AddItem Method
AddItemOfClassType Method
DeleteItem Method
AddItemOfArrayType Method

Highlight search results