UFT Reserved Objects > DTSheet Object > AddParameter Method
Unified Functional Testing Automation

AddParameter Method


Adds the specified parameter (column) to the sheet in the design-time or run-time data table, sets the value of the first row to the specified value, and returns the parameter so that you can directly set or retrieve properties of the new parameter in the same statement.


DTSheet.AddParameter(ParameterName, Value)




Assigns a name to the new parameter. If another parameter in the sheet has the same name, a number (i.e. '1') will be appended to the assigned ParameterName. If the ParameterName contains illegal characters, the illegal characters will be replaced with '_' characters.
Assigns a value to the first row of the parameter.

Return Value

DTParameter Object


The following example uses the AddParameter method to create the new Parameter, "Arrival" within the new sheet, MySheet of the design-time or run-time data table, and sets the first cell in the column as "New York". Because the method also returns the newly created parameter, it is possible to use methods or check properties of the new sheet within the same statement.

ParamName=DataTable.AddSheet("MySheet").AddParameter("Arrival", "New York").Name

Note that if a parameter with the name "Arrival" already exists in the sheet, the example above will return "Arrival1" as the actual name assigned to the new parameter.

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","Row1Value"

'copy the cells from the old column into the new column
For i=1 to cnt

'delete the old column

© Copyright 1992 - 2017 Hewlett-Packard Enterprise Development Company, L.P.