GetSheet Method

Description

Returns the specified sheet from the design-time or run-time data table.

Syntax

DataTable.GetSheet SheetID

Argument

Type

Description

SheetID
Variant
Identifies the sheet to be returned. The Sheet ID can be the sheet name or index. Index values begin with 1.

Return Value

DTSheet Object

Examples

The following example uses the GetSheet method to return the "MySheet" sheet of the design-time or run-time data table and add a parameter to it.

MyParam=DataTable.GetSheet ("MySheet").AddParameter("Time", "8:00")

You can also use this to add a parameter to the "MySheet" local sheet (note that no value is returned).

DataTable.GetSheet ("MySheet").AddParameter "Time", "8:00"

The example below performs the equivalent of renaming a column (parameter) in the DataTable by copying the data from one column to a new column with a new name, and then deleting the old column.

'add a new column
DataTable.GetSheet("Global").AddParameter "NewColumn","RowValueNew"
DataTable.GetSheet("Global").AddParameter "OldColumn","RowValueOld"

'copy the cells from the old column into the new column
cnt=DataTable.GetRowCount
For i=1 to cnt
    DataTable.SetCurrentRow(i)
    OldVal=DataTable.Value("OldColumn","Global")
    DataTable.Value("NewColumn","Global")=OldVal
Next

'delete the old column
DataTable.GetSheet("Global").DeleteParameter("OldColumn")