CreateEmptyTableWorkspace v1

../_images/CreateEmptyTableWorkspace-v1_dlg.png

CreateEmptyTableWorkspace dialog.

Summary

Creates an empty TableWorkspace which can be populated with various types of information.

Properties

Name Direction Type Default Description
OutputWorkspace Output TableWorkspace Mandatory The name of the table workspace that will be created.

Description

Creates an empty table workspace, which you can then populate with items of various types.

For a complete list of TableWorkspace methods accessible from Python please see the TableWorkspace Python API.

Usage

Example - Creating and Populating a Table

my_table = CreateEmptyTableWorkspace()

my_table.setTitle("My Data List")

my_table.addColumn("str", "Instrument Name")
my_table.addColumn("int", "Run Number")

my_table.addRow(["MUSR", 10245])
my_table.addRow(["IRIS", 8465])
my_table.addRow(["SANS2D", 20462])

print "The run number for IRIS is " + str(my_table.cell("Run Number", 1)) + "."
print "The number of rows is " + str(my_table.rowCount()) + "."
print "The title of the table is " + my_table.getTitle() + "."
print "Remember, the table is a workspace.  It's name is \"" + my_table.name() + "\"."

Output:

The run number for IRIS is 8465.
The number of rows is 3.
The title of the table is My Data List.
Remember, the table is a workspace.  It's name is "my_table".

Categories: Algorithms | Utility\Workspaces