Item Property

Applies to TestComplete 12.60, last modified on September 17, 2018
The Optical Character Recognition feature provided by the OCR plugin is deprecated. It was removed from TestComplete in version 12.60 and is no longer available for later versions.
Instead, TestComplete version 12.60 introduces the new Optical Character Recognition engine featuring Google Cloud Vision API. To learn more, see Optical Character Recognition.
If you need to use the legacy feature, please contact our Customer Care team.

Description

The IntCollection.Item property returns an item specified by its index in the given integer value collection represented by the IntCollection object.

Declaration

IntCollectionObj.Item(Index)

Read-Only Property Integer
IntCollectionObj An expression, variable or parameter that specifies a reference to an IntCollection object
Index [in]    Required    Integer    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

The index of the desired item in the collection of integer values. The index ranges between 0 and IntCollection.Count - 1.

Property Value

An integer value stored as a collection item.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the Item property in square brackets: Item[Index].

Example

The function below obtains all the items that belong to the collection specified as the function's parameter and then posts these items to the test log.

JavaScript, JScript

function ColItems(IntCol)
{
  // Obtains the number of items in the collection
  var Num = IntCol.Count;
  
  // Iterates through the items
  for (var i = 0; i < Num; i++)
  {
    // Obtains the current item
    var Item = IntCol.Item(i);
    // Converts the item to a string and posts it to the test log
    Log.Message( IntToStr(Item) );
  }
}

Python

def ColItems(IntCol):
  # Obtains the number of items in the collection
  Num = IntCol.Count
  # Iterates through the items
  for i in range(0, Num):
    # Obtains the current item
    Item = IntCol.Item[i]
    # Converts the item to a string and posts it to the test log
    Log.Message(IntToStr(Item))

VBScript

Sub ColItems(IntCol)

  ' Obtains the number of items in the collection
  Num = IntCol.Count
  
  ' Iterates through the items
  For i = 0 to (Num - 1)
    ' Obtains the current item
    Item = IntCol.Item(i)
    ' Converts the item to a string and posts it to the test log
    Log.Message( IntToStr(Item) )
  Next
  
End Sub

DelphiScript

function ColItems(IntCol);
var Num, i, Item;
begin

  // Obtains the number of items in the collection
  Num := IntCol.Count;
  
  // Iterates through the items
  for i := 0 to (Num - 1) do
  begin
    // Obtains the current item
    Item := IntCol.Item[i];
    // Converts the item to a string and posts it to the test log
    Log.Message( IntToStr(Item) );
  end;

end;

C++Script, C#Script

function ColItems(IntCol)
{
  // Obtains the number of items in the collection
  var Num = IntCol["Count"];
  
  // Iterates through the items
  for (var i = 0; i < Num; i++)
  {
    // Obtains the current item
    var Item = IntCol["Item"](i);
    // Converts the item to a string and posts it to the test log
    Log["Message"]( IntToStr(Item) );
  }
}

See Also

IntCollection.Count
IntCollection.Add
Using Optical Character Recognition

Highlight search results