Item Property

Applies to TestComplete 15.44, last modified on November 10, 2022
This property is provided by the legacy OCR plugin. In version 12.60, the plugin was replaced with the new Optical Character Recognition plugin powered by Google Cloud Vision API. To learn more, see Optical Character Recognition.
The legacy OCR plugin was removed from TestComplete in version 12.60. If you need to use objects, methods, and properties provided by the legacy plugin with this version of TestComplete, please contact our Customer Care team. The legacy OCR plugin was restored in TestComplete version 14.0. To use the objects, methods, and properties with this or later TestComplete version, you need to install and enable the plugin manually.

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