How to insert running number of each row in datatable

if i have running number data from database in example figure below
and I want to insert it into another datatable follow output figure
What program logic or programming technic to use for this case.Anybody can help me.pls

Hi @nuttapong_ludloy

B@sed on the while condition set @ counter @s while increementing the counter use re@d r@nge

@shwin S

Use Build datatable activity to crate a datatable and give it a name ex BuildDT
Use do while activity
Then inside do while use execute query activity to the DB to get the output
Then use for each row activity of the query out datatable
Then inside for each row activity
Use assign activity , create a DT variable ex : DT1 and initiate the DT in that assign activity
Use get row item activities to get the column values of both columns
Then use assign activity to combine 2 column values into a single variable ex : Variable1
Now use Add data row activity where in the properties , at row array property give value as {ID,Variable1}
And in Datatable property give table name as DT1

Now use merge Datatable activity

Input is DT1 and merge with BuildDT

1 Like

Assing variable to row(0).tostring + row(1).tostring the result Will bem what you whant :grin:

Then use 1 int variable to increment your A1 write cell and a second int variable to increment your b write cell on second DB