Converting datatable to datarow?

Hi all, I’ve data scrapped table values, and wanted to insert them into a custom datatable I’ve created for the unique headers.

I’m thinking of looping through the data in that ‘extracted data table’, but datatable.select() doesn’t work here. Any other ideas on how to add Dt → dr? Or just inserting data into the custom datatable I’ve made in general.

Tips appreciated, thanks!

Since a DataTable usually has multiple rows, it’s a bit weird to fit everything into a single row…

In any case, it seems you’re trying to iterate the rows of ExtractDataTable3 and, using the Add Data Row activity, add each row to another DataTable using datatable.select().
There are two problems with that:

  1. datatable.select() will give you an array of DataRow, but you already have it from using the For Each Row activity.
  2. Even if you pass just row to the Add Data Row activity, it’ll give you an error, because that row belongs to another table (ExtractDataTable3).

One possible solution is to pass row.ItemArray to the ArrayRow property of the Add Data Row activity: TransferingRows.zip (2.6 KB)

Let us know if you’re trying to do something different than this! If so, please provide more details. :+1:

4 Likes

Thanks, your solution worked! Didn’t think of row.ItemArray for that, kinda clueless onto that.

I’ll upload a copy of my files later after some quick modification, for anyone else who stumbles onto this sort of situation and wants a reference:

  • getting datatable (through data scrap or anything else)
  • have datatable (custom headers or just another data table)
  • wants to combine both together

Probably merging datatables would be good too in that scenario, but I recalled having tried it and it came out data stacked not ‘end-to-end’, horizontally stacking as a result.

1 Like

So as a fellow beginner, here’s a quick reference to other people who may encounter this as well! (slight modification of Maeteus’s suggestion into excel saving output)

Output:

mergingDataTable.xaml (11.3 KB)

Topic closed. :sunglasses:/ Thanks again Mateus!

1 Like