02-25-2010, 01:38 PM
Hi Vijyendra, you will need to understand the difference between the two i.e. SetCurrentRow and SetNextRow
SetCurrentRow sets the row specified as the current row in your Data Table, where SetNextRow sets the row after the active row as the new current row in the Data table. If the current row is the last row in the Data Table, this sets the first row in the Data Table as the new current row.
in your case here,
when you set a value in your first row. it is the last row in your datatable so applying SetNextRow will go back the first row itself,at the same time when you set the next row as your current active row using SetCurrentRow the current active row becomes 2 and applying SetNextRow activates 3rd row (below code)
if you put a SetNextRow again it will be back to the first row again as the current active is the last row
to better understand this, have a look at the below code
first statement activates the first row as the active row
applying SetNextRow in the second statement activates row 2 as the active row. you can not use setnext row alone.
try this
first stament will work here and goes to next row as by default the active row is 1.
on the second setnextrow stament it goes back to the first row
use SetNextRow only when the next row contains at least one value and use it when you are retriving values from Data table.
while setting values to datatable SetCurrentrow is sufficient, applying SetNextRow may create confusions.
Hope I am able to make it clear to you
SetCurrentRow sets the row specified as the current row in your Data Table, where SetNextRow sets the row after the active row as the new current row in the Data table. If the current row is the last row in the Data Table, this sets the first row in the Data Table as the new current row.
in your case here,
Code:
DataTable("MyCol","Action1")=123456
DataTable.GetSheet("Action1").SetNextRow
DataTable("MyCol","Action1")=1255
Code:
DataTable("MyCol","Action1")=123456
row=DataTable.GetSheet("Action1").getCurrentRow
DataTable.SetCurrentRow(row+1)
DataTable.GetSheet("Action1").SetNextRow
if you put a SetNextRow again it will be back to the first row again as the current active is the last row
Code:
DataTable("MyCol","Action1")=123456
row=DataTable.GetSheet("Action1").getCurrentRow
DataTable.SetCurrentRow(row+1)
DataTable.GetSheet("Action1").SetNextRow
DataTable.GetSheet("Action1").SetNextRow
to better understand this, have a look at the below code
Code:
DataTable.SetCurrentRow(1)
DataTable.GetSheet("Action1").SetNextRow
applying SetNextRow in the second statement activates row 2 as the active row. you can not use setnext row alone.
try this
Code:
DataTable.GetSheet("Action1").SetNextRow
DataTable("MyCol","Action1")=123456
DataTable.GetSheet("Action1").SetNextRow
on the second setnextrow stament it goes back to the first row
use SetNextRow only when the next row contains at least one value and use it when you are retriving values from Data table.
while setting values to datatable SetCurrentrow is sufficient, applying SetNextRow may create confusions.
Hope I am able to make it clear to you