Value Property

Applies to TestComplete 15.20, last modified on January 19, 2022

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 ArrayItem.Value property specifies the value of the array item. Note that if ArrayItemObj is an item of the array that belongs to a class, then modifying the value of this item will also change the item values in objects that are based on that class unless you have changed the item value in an object via your scripts or manually.

Declaration

ArrayItemObj.Value

Read-Write Property Variant
ArrayItemObj An expression, variable or parameter that specifies a reference to an ArrayItem object

Applies To

The property is applied to the following object:

Property Value

The value of the array item. It can hold any OLEVariant-compatible value: string, integer, object reference, array, etc.

Remarks

The Value property is the default one in the ArrayItem object and you can omit it when addressing the item value. For instance, the following two lines are equivalent:

Arr.Items(1).Value = 10
Arr.Items(1) = 10

You can even write Arr(1) = 10 since the Items property of the ArrayType and ArrayObject objects is used by default in these objects.

Example

The code below obtains the collection of properties that belong to the MyClass class and posts the properties' names and values to the test log.

JavaScript, JScript

function ArrayItem()
{
   // Obtains information about the MyClass class
   var PrCol = ODT.Classes.MyClass;
   for (var i = 0; i < PrCol.PropertyCount; i++)
   {
     // Obtains the current property's name
     var PrName = PrCol.Properties(i).Name;
     var PrValue = PrCol.Properties(i).Value;
     // Posts the property's name and value to the test log
     Log.Message(PrName + " property equals to " + PrValue);
   }
}

VBScript

Sub ArrayItem
   ' Obtains information about the MyClass class
   Set PrCol = ODT.Classes.MyClass
   For i = 0 to PrCol.PropertyCount-1
     ' Obtains the current property's name
     PrName = PrCol.Properties(i).Name
     PrValue = PrCol.Properties(i).Value
     ' Posts the property's name and value to the test log
     Log.Message(PrName & " property equals to " & PrValue)
   Next
End Sub

DelphiScript

function ArrayItem;
var PrCol, i, PrName, PrValue;
begin
   // Obtains information about the MyClass class
   PrCol := ODT.Classes.MyClass;
   For i := 0 to PrCol.PropertyCount-1 Do
   begin
     // Obtains the current property's name
     PrName := PrCol.Properties(i).Name;
     PrValue := PrCol.Properties(i).Value;
     // Posts the property's name and value to the test log
     Log.Message(PrName + ' property equals to ' + PrValue);
   end;
end;

C++Script, C#Script

function ArrayItem()
{
   // Obtains information about the MyClass class
   var PrCol = ODT["Classes"]["MyClass"];
   for (var i = 0; i < PrCol["PropertyCount"]; i++)
   {
     // Obtains the current property's name
     var PrName = PrCol["Properties"](i)["Name"];
     var PrValue = PrCol["Properties"](i)["Value"];
     // Posts the property's name and value to the test log
     Log["Message"](PrName + " property equals to " + PrValue);
   }
}

See Also

Index Property (ArrayItem Objects)
Name Property
Items Property
Items Property

Highlight search results