Escolar Documentos
Profissional Documentos
Cultura Documentos
Description
Adds the specified sheet to the run-time Data Table and returns the sheet so that you can
directly set properties of the new sheet in the same statement.
Syntax
DataTable.AddSheet(SheetName)
Argument
Type
SheetName
Variant
Description
Assigns a name to the new
sheet.
DeleteSheet
Description
Deletes the specified sheet from the run-time Data Table.
Syntax
DataTable.DeleteSheet SheetID
Argument
Type
Description
Sheet ID
Variant
Example
The following example uses the DeleteSheet method to delete the sheet, "MySheet" from the run-time Data
Table.
DataTable.DeleteSheet "MySheet"
Export Method
Description
Saves a copy of the run-time Data Table in the specified location.
Syntax
DataTable.Export(FileName)
Argument
Type
Description
FileName
String
Example
The following example uses the Export method to save a copy of the test's Data Table in C:\flights.xls.
DataTable.Export ("C:\flights.xls")
ExportSheet Method
Description
Exports a specified sheet of the run-time Data Table to the specified file.
If the specified file does not exist, a new file is created and the specified sheet is saved.
If the current file exists, but the file does not contain a sheet with the specified sheet name, the sheet is
inserted as the last sheet of the file.
If the current file exists and the file contains the specified sheet, the exported sheet overwrites the existing
sheet.
Syntax
DataTable.ExportSheet(FileName, DTSheet)
Argument
Type
Description
FileName
String
The full path of the Excel table to which you want to export a sheet
DTSheet
Variant
The name or index of the run-time Data Table sheet that you want to
export. Index values begin with 1.
Example
The following example uses the ExportSheet method to save the first sheet of the run-time Data Table to
the name.xls file.
DataTable.ExportSheet "C:\name.xls" ,1
GetCurrentRow Method
Description
Returns the current (active) row in the first sheet in the run-time Data Table (global sheet).
Syntax
: DataTable.GetCurrentRow
GetCurrentRow Method
Description
Returns the row number of the current (active) row in the run-time Data Table sheet.
Syntax
DTSheet.GetCurrentRow
GetRowCount Method
Description
Returns the total number of rows in the longest column in the first sheet in the run-time Data Table (global
sheet).
Syntax : DataTable.GetRowCount
Example
The following example uses the GetRowCount method to find the total number of rows in the
longest column of the MySheet run-time data sheet and writes it to the report.
rowcount = DataTable.GetSheet("MySheet").GetRowCount
Reporter.ReportEvent 2, "There are " &rowcount, "rows in the data sheet."
GetRowCount Method
Description
Returns the total number of rows in the longest column in the run-time Data Table sheet.
Syntax
: DTSheet.GetRowCount
Example
The following example uses the GetRowCount method to find the total number of rows
in the first column of the run-time Data Table sheet (MySheet) and writes it to the report.
rowcount = DataTable.GetSheet("MySheet").GetRowCount
Reporter.ReportEvent 2, "There are " &rowcount, "rows in the data sheet."
GetSheet Method
Description
Returns the specified sheet from the run-time Data Table.
Syntax : DataTable.GetSheet(SheetID)
Argument
Type
Description
SheetID
Variant
GetSheetCount Method
Description
Returns the total number of sheets in the run-time Data Table.
Syntax : DataTable.GetSheetCount
Return Value :
Number
Example
The following example uses the GetSheetCount method to find the total number of sheets in the
run-time Data Table and writes it to the report.
sheetcount = DataTable.GetSheetCount
Reporter.ReportEvent 0, "Sheet number", "There are " & sheetcount & " sheets in the Data Table."
GlobalSheet Property
Description
Returns the first sheet in the run-time Data Table (global sheet).
Syntax
: DataTable.GlobalSheet
Example
The following example uses the GlobalSheet property to return the global sheet of the run-time
Data Table in order to add a parameter (column) to it.
ParamValue=DataTable.GlobalSheet.AddParameter("Time", "5:45")
You can also use this method to add a parameter to the global sheet (note that no value is returned).
DataTable.GlobalSheet.AddParameter "Time", "5:45"
Import Method
Description
Imports the specified Microsoft Excel file to the run-time Data Table.
Notes:
The imported table must match the test. The column names must match the parameters in the test,
and the sheet names must match the action names.
If you import an Excel table containing combo box or list cells, conditional formatting, or other special
cell formats, the formats are not imported and the cell is displayed in the Data Table with a fixed value.
Syntax :
DataTable.Import(FileName)
Argument
Type
Description
FileName
String
Example
The imported table replaces all data in the existing run-time Data Table (including all data sheets).
The following example uses the Import method to import the flights.xls table to the run-time Data Table.
DataTable.Import ("C:\flights.xls")
ImportSheet Method
Description
Imports a sheet of a specified file to a specified sheet in the run-time Data Table. The data in the
imported sheet replaces the data in the destination sheet (see SheetDest argument).
Notes:
The column headings in the sheet you import must match the Data Table parameter names
in the action for which the sheet is being imported. Otherwise, your test or component may fail.
The sheet you import automatically takes the name of the sheet it replaces.
If you import an excel sheet containing combo box or list cells, conditional formatting, or other special
cell formats, the formats are not imported and the cell is displayed in the Data Table with a fixed value.
Type
Description
FileName
String
The full path of the Excel table from which you want to import a sheet.
SheetSource
Variant
The name or index of the sheet in the file that you want to import. Index values
begin with 1.
SheetDest
Variant
The name or index of the sheet in the Data Table that you want to replace with
the SheetSource. Index values begin with 1.
Example
The following example uses the ImportSheet method to import the first sheet of the name.xls
table to the name sheet in the test's run-time Data Table.
DataTable.ImportSheet "C:\name.xls" ,1 ,"name"
LocalSheet Property
Description
Returns the current (active) local sheet of the run-time Data Table.
Syntax : DataTable.LocalSheet
Example
The following example uses the LocalSheet property to return the local sheet of the run-time
Data Table in order to add a parameter (column) to it.
MyParam=DataTable.LocalSheet.AddParameter("Time", "5:45")
RawValue Property
Description
Retrieves the raw value of the cell in the specified parameter and the current row of the run-time Data Table.
The raw value is the actual string written in a cell before the cell has been computed, such as the actual text
from a formula.
Syntax
DataTable.RawValue ParameterID [, SheetID]
Argument
Type
Description
Parameter
InParameterID
Variant
SheetID
Variant
Example
The following example uses the RawValue property to find the formula used in the current row of the Date
column in the ActionA sheet in the run-time Data Table. The statement below returns the value: =NOW()
FormulaVal=DataTable.RawValue ("Date", "ActionA")
SetCurrentRow Method
Description
Sets the specified row as the current (active) row in the run-time Data Table.
Note: You can only set a row that contains at least one value.
Argument
Type
Description
RowNumber
Number
Example
The following example uses the SetCurrentRow method to change the active row to the second
row in the MySheet run-time data sheet.
DataTable.GetSheet("MySheet").SetCurrentRow(2)
SetNextRow Method
Description
Sets the row after the current (active) row as the new current row in the run-time Data Table sheet.
Note: You can only set a row that contains at least one value. If the current row is the last row in the Data
Table, applying this method sets the first row in the Data Table as the new current row.
Example
The following example uses the SetNextRow method to change the active row to the next row in
the run-time Data Table.
DataTable.GetSheet("MySheet").SetNextRow
(or)
DataTable.SetNextRow
SetPrevRow Method
Description
Sets the row above the current (active) row as the new current (active) row in the run-time Data Table sheet.
Syntax : DTSheet.SetPrevRow
(or)
DataTable. SetPrevRow
Example
The following example uses the SetPrevRow method to change the active row to the previous row
in the run-time data sheet.
DataTable.GetSheet("MySheet").SetPrevRow
(or)
DataTable. SetPrevRow
Value Property
Description
DataTable default property. Retrieves or sets the value of the cell in the specified parameter and
the current row of the run-time Data Table.
Note: This property returns the computed value of the cell. For example, if the cell contains a formula, the
method returns True or False.
Syntax
To find the value: DataTable.Value(ParameterID [, SheetID]) (or)
DataTable(ParameterID [, SheetID])
To set the value: DataTable.Value(ParameterID [, SheetID])=NewValue (or)
DataTable(ParameterID [, SheetID]) =NewValue
Argument
Type
Description
Parameter ID
Variant
SheetID
Variant
Optional. Identifies the sheet to be returned. The SheetID can be the sheet
name, index or dtLocalSheet, or dtGlobalSheet.
If no Sheet is specified, the first sheet in the run-time Data Table is used
(global sheet). Index values begin with 1.
NewValue
String
Example
The following example uses the Value property to set the value in the current row of the
Destination parameter (column) in the "ActionA" sheet in the run-time Data Table.
DataTable.Value ("Destination", "ActionA")="New York"
The following example uses the Value property to set the value in the current row of the
second parameter (column) in the third sheet.
DataTable.Value (2,3)="New York"
Note: You could omit the word Value in the statements above, because Value is the default
property for the DataTable object.
The following example uses the default property to set the value in the current row of the
Destination parameter (column) in the current (active) local sheet.
DataTable("Destination", dtlocalSheet)="New York"