SetCurrentRow Method

Description

Sets the specified row as the current (active) row in the design-time or run-time data table.

Important Information

  • You can set a row only if it contains at least one value.
  • If you call another action (local or external) after performing this method, then when you return to the current action after the called action is complete, the current row in the action sheet is reset to the row corresponding to the current iteration (regardless of the value previously set in the DataTable.SetCurrentRow step.)

Syntax

DataTable.SetCurrentRow RowNumber

Argument

Type

Description

RowNumber
Number
Indicates the number of the row to set as the active row. The first row is numbered 1.

Example

The following example uses the SetCurrentRow method to change the active row to the second row in the global design-time or run-time data table.

DataTable.SetCurrentRow (2)

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")