Tables Object

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

Description

The Tables object provides scripting access to elements of the Stores | Tables collection in your project.

The names of the Tables objects coincide with the names of the child Table's elements. Each property returns the Table object that corresponds to the appropriate child Table element. For instance, the following code provides access to the element named Table1:

JavaScript, JScript

var TableElem = Tables.Table1;

Python

TableElem = Tables.Table1

VBScript

Set TableElem = Tables.Table1

DelphiScript

var
  TableElem : OleVariant;
begin
  TableElem := Tables.Table1;
end;

C++Script, C#Script

var TableElem = Tables["Table1"];

Using methods and properties of the Table object you can access the element’s properties from scripts and perform a comparison of the stored data against the objects data. For more information, see Table Checkpoints.

Requirements

The object is available only if the project contains the Stores | Tables collection.

Members

Example

The following example demonstrates how you can use the Tables object to obtain and compare the elements of the Stores | Tables collection.

JavaScript, JScript

function TableCompare()
{
  var Tab1, Tab2;

  // Uses the appropriate property of the Tables, …
  // … to obtain the Table1 object in script.
  Tab1 = Tables.Table1;

  // Uses the appropriate property of the Tables, …
  // … to obtain the Table2 object in script.
  Tab2 = Tables.Table2;

  // Compares the table contents.
  Tab1.Compare(Tab2);

}

Python

def TableCompare():
  # Uses the appropriate property of the Tables, ...
  # ... to obtain the Table1 object in script.
  Tab1 = Tables.Table1
  # Uses the appropriate property of the Tables, ...
  # ... to obtain the Table2 object in script. 
  Tab2 = Tables.Table2
  # Compares the table contents. 
  Tab1.Compare(Tab2)

VBScript

Sub TableCompare
  Dim Tab1, Tab2

  ' Uses the appropriate property of the Tables, …
  ' … to obtain the Table1 object in script.
  Set Tab1 = Tables.Table1

  ' Uses the appropriate property of the Tables, …
  ' … to obtain the Table2 object in script.
  Set Tab2 = Tables.Table2

  ' Compares the table contents.
  Tab1.Compare(Tab2)

End Sub

DelphiScript

procedure TableCompare();
var Tab1, Tab2;

begin
  // Uses the appropriate property of the Tables, …
  // … to obtain the Table1 object in script.
  Tab1 := Tables.Table1;

  // Uses the appropriate property of the Tables, …
  // … to obtain the Table2 object in script.
  Tab2 := Tables.Table2;

  // Compares the table contents.
  Tab1.Compare(Tab2);

end;

C++Script, C#Script

function TableCompare()
{
  var Tab1, Tab2;

  // Uses the appropriate property of the Tables, …
  // … to obtain the Table1 object in script.
  Tab1 = Tables["Table1"];

  // Uses the appropriate property of the Tables, …
  // … to obtain the Table2 object in script.
  Tab2 = Tables["Table2"];

  // Compares the table contents .
  Tab1["Compare"] (Tab2);

}

See Also

About Table Checkpoints
About Tables Collection
Table Object

Highlight search results