How to manipulate a row item in a data table and "update" the data table

Hi, I am extracting a table from a website and save the data in a data table. A data table column (string) need to be manipulated before the data table is being uploaded to a DB.

The manipulation of the row item is done using VB in a assign activity. (remove 6 characters from left) So far, everything is good.

At this point I get stuck. I realize that this is very easy, but my brain is not working for this. So my question is:

After having done the assign activity within a “for-each” the manipulated string needs to be written into a new data table with the rest of the data in the original table, resulting in a data table that has the correct data in the column where the characters has been removed.

How do I do that best? (What are the correct steps after the assign activity?

Hi,

If i understood your requirement correctly, can you try to copy datatable, then assign modified data, as the following?

img20220130-3

Regards,

Hi @Botter ,

After you have used For Each Which Consists of Assign Activity.

The For Each datatable will perform the Changes on the Datatable.

After the For Each, you can simply use the Datatable that you have used as Input in For Each Datatable, in a Write Range Activity with the same file name of that of the Input (Or if needed in a Separate Sheet).

You should have the updated values in the File.

Yes, I have one data table where a string need to be manipulated in one column. I do that manipulation in a for-each activity where I use a assign activity to manipulate the string. And from this point I need to get the “Finished” data table.

I do not have a “write range” activity for data tables, only for Excel

Hi,

Can you share your current workflow? As @supermanPunch mentioned, if you assign some value to item of the datarow in ForEachRow, the datatable will be updated.

Regards,

Hi @Botter ,

The Write Range and Read Range activities are present in the System Activities Package.
Also another Package Excel Activities also do have these activities where you can manipulate datatable and write it back to the excel file.
image

In Excel Activities you would need to use a Excel Scope to use Write Range, Where as Workbook Write Range Activity would not need an Excel Scope.

Let us know if you are still facing issues and provide us with some screenshots of your workflow(Or Workflow file) and Dependencies being used.

Demo.xaml (7.6 KB)

Here is a simplified workflow. After this point I just need a data table that is updated with the manipulated colum

Hi,

If you want to update “Date” Column of DT_Main, the following will work. Can you try this?

Regards,

You are absolutely right! I have no idea how I managed to mess that up!

Thank you very much for your time and effort!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.