I have a scraped datatable under variable pScrapedOptionDT and I would like to put it into a different DT called ‘pOptionsDT’. The scraped data is taken from a specific header from a website and this value is stored, which correlated to pOptionsDT’s header names.
pOptionsDT has already been created and given headers correctly.
Essentially, I want to say:
'If pScrapedOptionDT column header X matches pOptionsDT column header X, add that scraped data to that column.
I added a for each to go through each column then added an ‘if’ to check the header, but then when I’ve done a ‘for each row in DT’ and added ‘add data row’, it hasn’t worked.
Can anyone explain what I need to input here? I think I may have the add data row section syntax wrong as it tells me that ‘Add Data Row: This row already belongs to this table.’ despite it being from one to another?
You could use a temporary table to extract the data in chunks, and then keep merging each chunk into the final data table until all the data is extracted.
we can simplify it and also omit the loop over the columns
If - myDataTableVar.Columns.Contains("MyColumnName")
then: For each row in pScrapedOptionDT * Add DataRow: DataTable: pOptionsDT, ArrayRow: new Object(){CurrentRow("ColumnName"}
and also we could more condense the modeling, if needed