AddParameter Method
Description
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.
Syntax
DTSheet.AddParameter(ParameterName, Value)
Return Value
Example
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 returns "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
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")