Hi,
I have 2 different datatable and I want to get the data from second datatable into first to create csv.
How to do it??
Hi @Kunal_Jain ,
Have you tried using the Merge Datatable
activity ?
Hi @Kunal_Jain,
You could try the following Add Data Row:
If you are in a For Each Row, then you would use CurrentRow.ItemArray
in place of DataTable1.Rows(0).ItemArray
Hi @Kunal_Jain ,
Can you confirm if the columns of both the data table are same or different?
If possible, let us know your input and expected output.
Regards,
No both the columns are different
It will merge 2 tables
But I need the data of some columns in datatable 2
Ok @Kunal_Jain , then you can put a for each row in data table for the data table you want the data to be taken from and inside the loop you can put the add datarow and pass the values from the first data table as array of values.
-Make sure the array you are passing has the same number of items as the second data table columns.
Regards,
It will paste the data in column one but I need to paste the data in different column as there will be data already present from datatable 1.
Check out these,
For Inersect
OutDatatable =dt1.AsEnumerable.Intersect(dt2.AsEnumerable,System.Data.DataRowComparer.Default).CopyToDataTable
For Except
Outdatatable=dt1.AsEnumerable.Except(dt2.AsEnumerable,System.Data.DataRowComparer.Default).CopyToDataTable
For union
Outdatatable=dt1.AsEnumerable.Union(dt2.AsEnumerable,System.Data.DataRowComparer.Default).CopyToDataTable
@Kunal_Jain , as you can see below, this will work for the scenario. it will add the data to the data table and won’t overwrite any existing data.
Hope you got the logic, please let me know if you still have any doubts
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.