ColumnCount Property

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

Description

The ColumnCount property returns the total number of columns in the table specified by the LogTableDataSchemeObj object, which holds the table’s scheme.

To obtain a column, you can use the Column or ColumnByName properties.

Declaration

LogTableDataSchemeObj.ColumnCount

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

Applies To

The property is applied to the following object:

Property Value

An integer number that signifies the total number of columns in the table described by the given scheme.

Example

The code below obtains the total number of columns that belong to the specified data scheme and then posts this number to the test log.

JavaScript, JScript

function ColumnCount()
{
  // 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 number of columns
  var Num = Sch.ColumnCount;
  Log.Message(Num);
}

Python

def ColumnCount():
  # 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 number of columns
  Num = Sch.ColumnCount
  Log.Message(Num)

VBScript

Sub ColumnCount()

  ' 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 number of columns
  Num = Sch.ColumnCount
  Log.Message(Num)
 
End Sub

DelphiScript

function ColumnCount;
var LogsCol, LogItem, LogData, Sch, Num;
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 number of columns
  Num := Sch.ColumnCount;
  Log.Message(Num);

end;

C++Script, C#Script

function ColumnCount()
{
  // 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 number of columns
  var Num = Sch["ColumnCount"];
  Log["Message"](Num);
}

See Also

Access Test Log Contents from Tests
Column Property
ColumnByName Property

Highlight search results