ChildData Property

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

Description

A table row can have child data (do not confuse child data with child rows). This is the data displayed in additional log panels when you select the given table row. For example, in case of the table in the Test Log pane of the generic script log, the child datasets for the table row are data that is displayed in the Details and Picture panels.

The ChildData property let you obtain the child dataset of the given table row. The dataset to obtain is specified by its scheme.

Declaration

LogTableRowObj.ChildData(DataScheme)

Read-Only Property A LogTableData, TextLogData or PictureLogData object
LogTableRowObj An expression, variable or parameter that specifies a reference to a LogTableRow object
DataScheme [in]    Required    A LogDataScheme object    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

DataScheme

A LogDataScheme object holding the scheme of the desired child dataset.

Property Value

A LogTableData, TextLogData or PictureLogData object which contains the desired child dataset. To determine the type of the resulting object, use its Scheme.DataType property.

Remarks

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

You can also obtain the child dataset using the ChildDataByIndex or ChildDataByName property.

Example

The following example demonstrates how to obtain a row’s child dataset for data displayed in the Details panel and how to export that data to an external file.

JavaScript

function TableDataRowSample()
{
  // Obtains a log item
  var Logs = Project.Logs;
  var LogItem = Logs.LogItem(0);
  // Obtains the log item’s dataset
  var LogData = LogItem.Data(0);

  var DType = LogData.Scheme.DataType;
  // Checks whether the dataset corresponds to the table
  if (DType == 0)
  {
    // Obtains a table row by its index
    var Row = LogData.Rows(0);

    // Obtains the data scheme of the data displayed in the Details panel
    var ChildDataScheme = LogData.Scheme.Child(1);
    // Obtains the dataset by its scheme
    var ChildDataSet = Row.ChildData(ChildDataScheme);
    // Checks whether the dataset is TextLogData
    if (ChildDataSet.Scheme.DataType == 1)

    {
      // Specifies an external file to export the text to
      var ExportFileName = "D:\\Work Folder\\ExportedLog\\Details.html";

      // Exports the text from the Details panel to the external file
      FS = getActiveXObject("Scripting.FileSystemObject");
      ExportFile = FS.CreateTextFile(ExportFileName, true);
      ExportFile.WriteLine(ChildDataSet.Text);
      ExportFile.Close();
    }

  }

}

JScript

function TableDataRowSample()
{
  // Obtains a log item
  var Logs = Project.Logs;
  var LogItem = Logs.LogItem(0);
  // Obtains the log item’s dataset
  var LogData = LogItem.Data(0);

  var DType = LogData.Scheme.DataType;
  // Checks whether the dataset corresponds to the table
  if (DType == 0)
  {
    // Obtains a table row by its index
    var Row = LogData.Rows(0);

    // Obtains the data scheme of the data displayed in the Details panel
    var ChildDataScheme = LogData.Scheme.Child(1);
    // Obtains the dataset by its scheme
    var ChildDataSet = Row.ChildData(ChildDataScheme);
    // Checks whether the dataset is TextLogData
    if (ChildDataSet.Scheme.DataType == 1)

    {
      // Specifies an external file to export the text to
      var ExportFileName = "D:\\Work Folder\\ExportedLog\\Details.html";

      // Exports the text from the Details panel to the external file
      FS = Sys.OleObject("Scripting.FileSystemObject");
      ExportFile = FS.CreateTextFile(ExportFileName, true);
      ExportFile.WriteLine(ChildDataSet.Text);
      ExportFile.Close();
    }

  }

}

Python

def TableDataRowSample():
  # Obtains a log item
  Logs = Project.Logs
  LogItem = Logs.LogItem[0]
  # Obtains the log item's dataset
  LogData = LogItem.Data[0]
  DType = LogData.Scheme.DataType;
  # Checks whether the dataset corresponds to the table
  if DType == 0:
    # Obtains a table row by its index
    Row = LogData.Rows[0]
    # Obtains the data scheme of the data displayed in the Additional Info panel
    ChildDataScheme = LogData.Scheme.Child[1]
    # Obtains the dataset by its scheme
    ChildDataSet = Row.ChildData[ChildDataScheme]
    # Checks whether the dataset is TextLogData
    if ChildDataSet.Scheme.DataType == 1:
      # Specifies an external file to export the text to
      ExportFileName = "D:\\Work Folder\\ExportedLog\\AdditionalInfo.html"
      # Exports the text from the Additional Info panel to the external file
      FS = Sys.OleObject["Scripting.FileSystemObject"]
      ExportFile = FS.CreateTextFile(ExportFileName, True)
      ExportFile.WriteLine(ChildDataSet.Text)
      ExportFile.Close()

VBScript

Sub TableDataRowSample

  ' Obtains a log item
  Set Logs = Project.Logs
  Set LogItem = Logs.LogItem(0)
  ' Obtains the log item’s dataset
  Set LogData = LogItem.Data(0)

  DType = LogData.Scheme.DataType
  ' Checks whether the dataset corresponds to the table
  If DType = 0 Then
    ' Obtains a table row by its index
    Set Row = LogData.Rows(0)

    ' Obtains the data scheme of the data displayed in the Details panel
    Set ChildDataScheme = LogData.Scheme.Child(1)
    ' Obtains the dataset by its scheme
    Set ChildDataSet = Row.ChildData(ChildDataScheme)
    ' Checks whether the dataset is TextLogData
    If ChildDataSet.Scheme.DataType = 1 Then

      ' Specifies an external file to export the text to
      ExportFileName = "D:\Work Folder\ExportedLog\Details.html"

      ' Exports the text from the Details panel to the external file
      Set FS = Sys.OleObject("Scripting.FileSystemObject")
      Set ExportFile = FS.CreateTextFile(ExportFileName, True)
      ExportFile.WriteLine ChildDataSet.Text
      ExportFile.Close
    End If

  End If

End Sub

DelphiScript

procedure TableDataRowSample();
var
  Logs, LogItem, LogData, DType, Row, ChildDataScheme, ChildDataSet, ExportFile, ExportFileName;
begin
  // Obtains a log item
  Logs := Project.Logs;
  LogItem := Logs.LogItem(0);
  // Obtains the log item’s dataset
  LogData := LogItem.Data(0);

  DType := LogData.Scheme.DataType;
  // Checks whether the dataset corresponds to the table
  if DType = 0 then
  begin
    // Obtains a table row by its index
    Row := LogData.Rows[0];

    // Obtains the data scheme of the data displayed in the Details panel
    ChildDataScheme := LogData.Scheme.Child[1];
    // Obtains the dataset by its scheme
    ChildDataSet := Row.ChildData[ChildDataScheme];
    // Checks whether the dataset is TextLogData
    if ChildDataSet.Scheme.DataType = 1 then

    begin
      // Specifies an external file to export the text to
      ExportFileName := 'D:\Work Folder\ExportedLog\Details.html';

      // Exports the text from the Details panel to the external file
      AssignFile(ExportFile, ExportFileName);
      Rewrite(ExportFile);
      WriteLn(ExportFile, ChildDataSet.Text);
      CloseFile(ExportFile);
    end;

  end;

end;

C++Script, C#Script

function TableDataRowSample()
{
  // Obtains a log item
  var Logs = Project["Logs"];
  var LogItem = Logs["LogItem"](0);
  // Obtains the log item’s dataset
  var LogData = LogItem["Data"](0);

  var DType = LogData["Scheme"]["DataType"];
  // Checks whether the dataset corresponds to the table
  if (DType == 0)
  {
    // Obtains a table row by its index
    var Row = LogData["Rows"](0);

    // Obtains the data scheme of the data displayed in the Details panel
    var ChildDataScheme = LogData["Scheme"]["Child"](1);
    // Obtains the dataset by its scheme
    var ChildDataSet = Row["ChildData"](ChildDataScheme);
    // Checks whether the dataset is TextLogData
    if (ChildDataSet["Scheme"]["DataType"] == 1)

    {
      // Specifies an external file to export the text to
      var ExportFileName = "D:\\Work Folder\\ExportedLog\\Details.html";

      // Exports the text from the Details panel to the external file
      FS = Sys["OleObject"]("Scripting.FileSystemObject");
      ExportFile = FS["CreateTextFile"](ExportFileName, true);
      ExportFile["WriteLine"](ChildDataSet["Text"]);
      ExportFile["Close"]();
    }

  }

}

See Also

Access Test Log Contents from Tests
ChildDataByIndex Property
ChildDataByName Property

Highlight search results