Values Property

Applies to TestComplete 14.71, last modified on April 22, 2021

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 PropValueSet.Values property returns an item of the PropValueSet collection specified by item index. The total number of elements in the array is specified by the Count property.

Declaration

PropValueSetObj.Values(Index)

Read-Only Property String
PropValueSetObj An expression, variable or parameter that specifies a reference to a PropValueSet object
Index [in]    Required    Integer    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

Specifies the index of the item in the collection. The first item in the collection has index 0, the second - 1, etc.

Property Value

A string that represents the specified value.

Remarks

If you use DelphiScript, you need to enclose Index in square brackets, i.e. Values[Index].

Example

The following example iterates through the elements of the PropValueSet collection, posts values stored in the collection to the test log informing whether the values will be processed by the Run method.

JavaScript, JScript

function PropValueSetSample()
{
  // Obtains the specified class
  var MyClassObj = ODT.Classes.MyClass;
  // Obtains the PropValueSet collection
  var PropValueSetObj = MyClassObj.PropValueSet("MyProperty");
  // Determines the total number of items in the collection
  var Count = PropValueSetObj.Count;

  // Iterates through the collection
  for (var i = 0; i < Count; i++)
  {
    // Posts a value to the test log and informs whether it will be processed
    var Value = PropValueSetObj.Values(i);
    if (PropValueSetObj.Checked(i))
      Log.Message(Value + ": Enabled")
    else
      Log.Message(Value + ": Disabled");
  }
}

VBScript

Sub PropValueSetSample

  ' Obtains the specified class
  Set MyClassObj = ODT.Classes.MyClass
  ' Obtains the PropValueSet collection
  Set PropValueSetObj = MyClassObj.PropValueSet("MyProperty")
  ' Determines the total number of items in the collection
  Count = PropValueSetObj.Count

  ' Iterates through the collection
  For i = 0 To Count - 1
    ' Posts a value to the test log and informs whether it will be processed
    Value = PropValueSetObj.Values(i)
    If PropValueSetObj.Checked(i) Then
      Log.Message(Value & ": Enabled")
    Else
      Log.Message(Value & ": Disabled")
    End If
  Next
End Sub

DelphiScript

procedure PropValueSetSample();
var MyClassObj, PropValueSetObj, Count, Value, i;
begin
  // Obtains the specified class
  MyClassObj := ODT.Classes.MyClass;
  // Obtains the PropValueSet collection
  PropValueSetObj := MyClassObj.PropValueSet['MyProperty'];
  // Determines the total number of items in the collection
  Count := PropValueSetObj.Count;

  // Iterates through the collection
  for i := 0 to Count - 1 do
  begin
    // Posts a value to the test log and informs whether it will be processed
    Value := PropValueSetObj.Values[i];
    if PropValueSetObj.Checked[i] then
      Log.Message(Value + ': Enabled')
    else
      Log.Message(Value + ': Disabled');
  end;
end;

C++Script, C#Script

function PropValueSetSample()
{
  // Obtains the specified class
  var MyClassObj = ODT["Classes"]["MyClass"];
  // Obtains the PropValueSet collection
  var PropValueSetObj = MyClassObj["PropValueSet"]("MyProperty");
  // Determines the total number of items in the collection
  var Count = PropValueSetObj["Count"];

  // Iterates through the collection
  for (var i = 0; i < Count; i++)
  {
    // Posts a value to the test log and informs whether it will be processed
    var Value = PropValueSetObj["Values"](i);
    if (PropValueSetObj["Checked"](i))
      Log["Message"](Value + ": Enabled")
    else
      Log["Message"](Value + ": Disabled");
  }
}

See Also

Count Property
ValueIndex Property
Checked Property

Highlight search results