Working With the Table Variable Editor

Applies to TestComplete 15.64, last modified on June 12, 2024

To edit the Table type variables, you can use special dialogs and wizards of TestComplete. Using them you can add and delete rows and columns of the array stored in the Table variable and specify the values of the array elements.

These dialogs and wizards have the toolbar and the edit field where you can change array’s content.

To add and delete the array columns and rows, use the Columns and Rows boxes on the toolbar. The created table will be displayed in the edit field. The columns and rows are numbered. Using these numbers you can access to the desired element of the array from tests.

To populate any column with randomly generated test data, use the button on the editor's toolbar. When you click this button, the Generate Data dialog appears. In this dialog, you can specify additional parameters for the generated values and obtain sample values produced by the generator.

You can rename the columns headers. To do this, click the desired column and enter a name. When specifying the name, TestComplete adds additional properties to the TableVariable object. These properties allow you to obtain the value of the desired element of the array. The properties are named as columns and have the Index parameter. You use this parameter to specify the row that contains the desired element.

Note: The column name must match the naming rules of the scripting language used in your project. The easiest way to do this is to specify a name that only consists of alphanumeric or underscore characters and starts with a letter.

The elements of the array have the Variant type. To specify an element of the array, click the desired cell in the edit field of the dialog and enter any value: number, string, date and so on.

The dialog’s toolbar contains the following buttons and commands that affect the array’s content.

  • - Opens the Generate Data dialog that helps you populate the desired table's column with randomly generated test data.
  • - Cuts the value of the current cell to the clipboard.
  • - Copies the value of the current cell to the clipboard.
  • - Pastes the copied value to the current cell.
  • Insert Row - Inserts an empty row to the array.
  • Delete Row - Deletes the specified row.
  • Auto Width - Allows all columns to be squeezed into view.

You can also right-click the desired cell of the array and call these commands from the context menu. The context menu also contains the Clear Row command that clear the cells in the specified row.

More commands are available in the context menu that appears when you right-click the array column:

  • Rename Column - Allows you to specify the name of the desired column.
  • Delete Column - Deletes the specified column.
  • Adjust Column Width - Allows you change the column width by dragging the separator between the columns.

You can also modify the value of the desired Table variable directly from your script. For this purpose, use the TableVariable.Item property:


let s;
    s = "John";
    Project.Variables.MyVar.$set("Item", 0, 0, s);
// -- or --
    Project.Variables.VariableByName("MyVar").$set("CustomerName", 0, s);


var s;
    s = "John";
    Project.Variables.MyVar.Item(0, 0) = s;
// -- or --
    Project.Variables.VariableByName("MyVar").CustomerName(0) = s;


s = "John"
Project.Variables.MyVar.Item(0, 0) = s
# -- or --
Project.Variables.VariableByName["MyVar"].CustomerName(0) = s


s = "John"
Project.Variables.MyVar.Item(0, 0) = s
' -- or --
Project.Variables.VariableByName("MyVar").CustomerName(0) = s


  s : OleVariant;
      s := 'John';
      Project.Variables.MyVar.Item(0, 0) := s;
  // -- or --
      Project.Variables.VariableByName('MyVar').CustomerName(0) := s;

C++Script, C#Script

var s;
    s = "John";
    Project["Variables"]["MyVar"].Item(0, 0) = s;
// -- or --
    Project["Variables"]["VariableByName"]("MyVar").CustomerName(0) = s;

See Also

Variables of the Table Type
Edit Table Variable Dialog
Add Variable Wizard
Add Variable to Keyword Test Wizard
Variable Data Types

Highlight search results