DataType Property

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The TestComplete log can hold three types of data: table, text and picture. To determine the type of data stored in the dataset, use the DataType property of the LogDataScheme or LogTableDataScheme object, which holds the scheme of the desired dataset.

Declaration

ProgObj.DataType

Read-Only Property Integer
ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section

Applies To

The property is applied to the following objects:

Property Value

One of the following constants defined in the BuiltIn object:

Constant Value Description
ldtTable 0 Tabular data or data in the tree-like list
ldtText 1 Text data (plain text, HTML, XML or an URL string)
ldtPicture 2 Picture

Example

The code below obtains the data type of the specified dataset.

JavaScript, JScript

function LogDataTypeExample()
{
  // Obtains a collection of logs
  var LogsCol = Project.Logs;
  // Obtains the first log item
  var LogItem = LogsCol.LogItem(0);
  // Obtains the first dataset
  // of the specified log item
  var LogData = LogItem.Data(0);
  // Obtains the scheme of the dataset
  var Sch = LogData.Scheme;
  // Obtains the data type of the first dataset
  var LogDataType = Sch.DataType;
  
  // Checks the data type
  if ( LogDataType == ldtTable )
    Log.Message("The dataset contains tabular data or data in a tree-like list.");
  else 
    if ( LogDataType == ldtText )
      Log.Message("The dataset contains text data.");
    else 
      Log.Message("The dataset contains pictures.");
}

Python

def LogDataTypeExample():
  # Obtains a collection of logs
  LogsCol = Project.Logs
  # Obtains the first log item
  LogItem = LogsCol.LogItem[0]
  # Obtains the first dataset
  # of the specified log item
  LogData = LogItem.Data[0]
  # Obtains the scheme of the dataset
  Sch = LogData.Scheme
  # Obtains the data type of the first dataset
  LogDataType = Sch.DataType
  # Checks the data type
  if LogDataType == ldtTable:
    Log.Message("The dataset contains tabular data or data in a tree-like list.")
  else:
    if LogDataType == ldtText:
      Log.Message("The dataset contains text data.")
    else:
      Log.Message("The dataset contains pictures.")

VBScript

Sub LogDataTypeExample()

  ' Obtains a collection of logs
  Set LogsCol = Project.Logs
  ' Obtains the first log item
  Set LogItem = LogsCol.LogItem(0)
  ' Obtains the first dataset
  ' of the specified log item
  Set LogData = LogItem.Data(0)
  ' Obtains the scheme of the dataset
  Set Sch = LogData.Scheme
  ' Obtains the data type of the first dataset
  LogDataType = Sch.DataType
  
  ' Checks the data type
  If LogDataType = ldtTable Then
    Log.Message("The dataset contains tabular data or data in a tree-like list.")
  Else 
    If LogDataType = ldtText Then
      Log.Message("The dataset contains text data.")
    Else 
      Log.Message("The dataset contains pictures.")
    End If 
  End If
  
End Sub

DelphiScript

function LogDataTypeExample;
var LogsCol, LogItem, LogData, Sch, LogDataType;
begin

  // Obtains a collection of logs
  LogsCol := Project.Logs;
  // Obtains the first log item
  LogItem := LogsCol.LogItem(0);
  // Obtains the first dataset
  // of the specified log item
  LogData := LogItem.Data(0);
  // Obtains the scheme of the dataset
  Sch := LogData.Scheme;
  // Obtains the data type of the first dataset
  LogDataType := Sch.DataType;
  
  // Checks the data type
  if ( LogDataType = ldtTable ) then
    Log.Message('The dataset contains tabular data or data in a tree-like list.')
  else 
    if ( LogDataType = ldtText ) then
      Log.Message('The dataset contains text data.')
    else 
      Log.Message('The dataset contains pictures.');

end;

C++Script, C#Script

function LogDataTypeExample()
{
  // Obtains a collection of logs
  var LogsCol = Project["Logs"];
  // Obtains the first log item
  var LogItem = LogsCol["LogItem"](0);
  // Obtains the first dataset
  // of the specified log item
  var LogData = LogItem["Data"](0);
  // Obtains the scheme of the dataset
  var Sch = LogData["Scheme"];
  // Obtains the data type of the first dataset
  var LogDataType = Sch["DataType"];
  
  // Checks the data type
  if ( LogDataType == ldtTable )
    Log["Message"]("The dataset contains tabular data or data in a tree-like list.");
  else 
    if ( LogDataType == ldtText )
      Log["Message"]("The dataset contains text data.");
    else 
      Log["Message"]("The dataset contains pictures.");
}

See Also

Access Test Log Contents from Tests
Child Property
ChildCount Property
Name Property

Highlight search results