Overwrite a row in a Datatable

Hello,

I used to use Write Range, and overwrite a signle row with it’s index, this way, i was able to update the row needed. Now, I need to remove the write range, so I need to find a way to overwrite the row like used to do on the Write Range. Any ideas ?

Cheers

@ppr

Hello, do you have any ideas please :slight_smile:

How you’ll add data now in the file?

Your post headers says Datatable

are you asking just to replace the data in a datatable?

In datatable you can simply clear the datatable using Clear Datatable Activity. Then simply add the new data.

No, I need to keep the original data and with the index of each row, I must update some values.

you mean to add the new data below the existing one?

That can he done using Append range activity

It’ll put the new datatable below the existing one in that file

Append range, will add new rows and overwrite any previous row, I need to find each row and update the content…

@maroua301
You should be able to use a for each row in DT to do this. You can update the values using row(“columnName”) in an assign and assign it a new value.

append range won’t overwrite the data in excel… it’ll append

My purpose is to overwrite, I made a copy of the row, updated all values needed, now need to overwrite on old datatable

I already updated all the values needed, now trying to figure out how to add it to the existing datatable and overwrite the old row

@maroua301

Doing what I suggested adds the new values to the datatable and overwrites the old values…

Using an assign in a for each row in dt will overwrite whatever cell you reference by column in the row it is on at the time.

It sounds like that is what you are trying to do, correct?

it seems you just need to replace a row content only.

that can be done using for each data row loop, find the particular row using if statement, once found replace it

OR

you can get row index using LOOKUP Datatable, mention the row element you need to search and the column in which that row element will be and then update that particular row with that found index

@maroua301
Small snip to help illustrate. Doing this allows you to change the particular cell as referenced by the row and column.

image

@BenZee

I appreciate your help, but that’s not what I’m looking for. I’m using the reframework, in each transaction, i get the whole row, using this io_dtDC.Select("[JK]='"+in_TransactionItem("JK").ToString+"'").CopyToDataTable(), later I used, to use write range, in the end of each transaction, with the index of the current row. Now I’m trying to find a way, to store all that transaction, in a DT, until the end of the process.