DataType Property

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

The DataType property specifies the type of data stored in the given log table column.

Declaration

LogColumnObj.DataType

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

Applies To

The property is applied to the following object:

Property Value

One of the following constants defined in the BuiltIn object:

Constant Value Description
ctInteger 0 An integer number
ctString 1 A string
ctFloat 2 A floating-point number
ctBoolean 3 A boolean value
ctImage 4 An image
ctHyperlink 5 A hyperlink
ctDateTime 6 A date or time value

Example

The code below obtains the name and data type of the specified test log column using the LogColumn object and its properties.

JavaScript, JScript

function LogColumn()
{
  // 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 information about the third column
  var Column = Sch.Column(2);
  // Obtains the name of the third column
  var Name = Column.Name;
  Log.Message("The " + Name + " column contains the following data:");
  
  // Obtains the data type of the third column
  switch (Column.DataType)
  {
    case ctInteger:
    {
      Log.Message("integer numbers");
      break;
    }
    case ctString:
    {
      Log.Message("strings");
      break;
    }
    case ctFloat:
    {
      Log.Message("floating-point numbers");
      break;
    }
    case ctBoolean:
    {
      Log.Message("boolean values");
      break;
    }
    case ctImage:
    {
      Log.Message("images");
      break;
    }
    case ctHyperlink:
    {
      Log.Message("hyperlinks");
      break;
    }
    case ctDateTime:
    {
      Log.Message("date or time values");
      break;
    }
  }
}

Python

def LogColumn():
  # 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 information about the third column
  Column = Sch.Column[2]
  # Obtains the name of the third column
  Name = Column.Name
  Log.Message("The " + Name + " column contains the following data:") 
  # Obtains the data type of the third column
  if Column.DataType == ctInteger:
    Log.Message("integer numbers")
  elif Column.DataType == ctString:
    Log.Message("strings")
  elif Column.DataType == ctFloat:
    Log.Message("floating-point numbers");
  elif Column.DataType == ctBoolean:
    Log.Message("boolean values")
  elif Column.DataType == ctImage:
    Log.Message("images")
  elif Column.DataType == ctHyperlink:
    Log.Message("hyperlinks")
  elif Column.DataType == ctDateTime:
    Log.Message("date or time values")

VBScript

Sub LogColumn()
  ' 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 information about the third column
  Set Column = Sch.Column(2)
  ' Obtains the name of the third column
  Name = Column.Name
  Log.Message("The " & Name & " column contains the following data:")
  
  ' Obtains the data type of the third column
  Select case Column.DataType
    case ctInteger: Log.Message("integer numbers")
    case ctString: Log.Message("strings")
    case ctFloat: Log.Message("floating-point numbers")
    case ctBoolean: Log.Message("boolean values")
    case ctImage: Log.Message("images")
    case ctHyperlink: Log.Message("hyperlinks")
    case ctDateTime: Log.Message("date or time values")
  End Select
 
End Sub

DelphiScript

function LogColumn;
var LogsCol, LogItem, LogData, Sch, Column, Name;
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 information about the third column
  Column := Sch.Column(2);
  // Obtains the name of the third column
  Name := Column.Name;
  Log.Message('The ' + Name + ' column contains the following data:');
  
  // Obtains the data type of the third column
  case Column.DataType of
    ctInteger: Result : = Log.Message('integer numbers');
    ctString: Result := Log.Message('strings');
    ctFloat: Result := Log.Message('floating-point numbers');
    ctBoolean: Result := Log.Message('boolean values');
    ctImage: Result := Log.Message('images');
    ctHyperlink: Result := Log.Message('hyperlinks');
    ctDateTime: Result := Log.Message('date or time values');
  end;

end;

C++Script, C#Script

function LogColumn()
{
  // 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 information about the third column
  var Column = Sch["Column"](2);
  // Obtains the name of the third column
  var Name = Column["Name"];
  Log["Message"]("The " + Name + " column contains the following data:");
  
  // Obtains the data type of the third column
  switch (Column["DataType"])
  {
    case ctInteger:
    {
      Log["Message"]("integer numbers");
      break;
    }
    case ctString:
    {
      Log["Message"]("strings");
      break;
    }
    case ctFloat:
    {
      Log["Message"]("floating-point numbers");
      break;
    }
    case ctBoolean:
    {
      Log["Message"]("boolean values");
      break;
    }
    case ctImage:
    {
      Log["Message"]("images");
      break;
    }
    case ctHyperlink:
    {
      Log["Message"]("hyperlinks");
      break;
    }
    case ctDateTime:
    {
      Log["Message"]("date or time values");
      break;
    }
  }
}

See Also

Access Test Log Contents from Tests
Name Property

Highlight search results