DataCount Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Use the DataCount property to get the total number of datasets that the given log item holds. The log item can have more than one dataset. To obtain the reference to a log item’s dataset by its index, use the Data property.

Declaration

LogItemObj.DataCount

Read-Only Property Integer
LogItemObj An expression, variable or parameter that specifies a reference to a LogItem object

Applies To

The property is applied to the following object:

Property Value

An integer number that signifies the total number of datasets in the given log item.

Example

The code below obtains the total number of datasets that belong to the specified log item and then posts this number to the test log.

JavaScript, JScript

function DataCountExample()
{
  // Obtains a collection of logs
  var LogsCol = Project.Logs;
  // Obtains the first log item
  var LogItem = LogsCol.LogItem(0);
  
  // Obtains the total number of datasets
  // that belong to the log item
  var Num = LogItem.DataCount;
  // Posts this number to the test log
  Log.Message("The first log item contains " + Num + " dataset(s).");
}

Python

def DataCountExample():
  # Obtains a collection of logs
  LogsCol = Project.Logs
  # Obtains the first log item
  LogItem = LogsCol.LogItem[0]
  # Obtains the total number of datasets
  # that belong to the log item
  Num = LogItem.DataCount
  # Posts this number to the test log
  Log.Message("The first log item contains " + str(Num) + " dataset(s).")

VBScript

Sub DataCountExample()

  ' Obtains a collection of logs
  Set LogsCol = Project.Logs
  ' Obtains the first log item
  Set LogItem = LogsCol.LogItem(0)
  
  ' Obtains the total number of datasets
  ' that belong to the log item
  Num = LogItem.DataCount
  ' Posts this number to the test log
  Log.Message("The first log item contains " & Num & " dataset(s).")
    
End Sub

DelphiScript

function DataCountExample;
var LogsCol, LogItem, Num;
begin

  // Obtains a collection of logs
  LogsCol := Project.Logs;
  // Obtains the first log item
  LogItem := LogsCol.LogItem[0];
  
  // Obtains the total number of datasets
  // that belong to the log item
  Num := LogItem.DataCount;
  // Posts this number to the test log
  Log.Message('The first log item contains ' + Num + ' dataset(s).');

end;

C++Script, C#Script

function DataCountExample()
{
  // Obtains a collection of logs
  var LogsCol = Project["Logs"];
  // Obtains the first log item
  var LogItem = LogsCol["LogItem"](0);
  
  // Obtains the total number of datasets
  // that belong to the log item
  var Num = LogItem["DataCount"];
  // Posts this number to the test log
  Log["Message"]("The first log item contains " + Num + " dataset(s).");
}

See Also

Access Test Log Contents from Tests
LogItem Object
Child Property
ChildCount Property
Data Property

Highlight search results