If I need to join two data tables with different-different column names and different-different data?
or
I want to join two data tables without any conditions.
-
I have the first Data Table dt_FirstDataTable with two columns Name, City.
-
I have the second Data Table dt_SecondDataTable with two columns Phone, Age.
-
I want a final table with all columns value Name, City, Phone, Age. So what can I do?
Solution: -
-
We have to create a String-type array variable to store the data table columns name.
-
Write a Syntax to get data table columns’ names into an Array variable.
(from name in dt_SecondDataTable.Columns.Cast(of DataColumn)Select name.ColumnName).ToArray
-
We have to add a second data table (dt_SecondDataTable) column into the first data table (dt_FirstDataTable) without column values with the help of For Each loop and Add Data Column Activity.
-
With the help of For Each Row in Data Table activity, we have to add a second data table (dt_SecondDataTable) column value into the first data table (dt_FirstDataTable).
-
Here we have to get the Index value for Second Data Table.
-
With the help of For Each loop activity, BOT will add a second data table value one by one in the first data table.
Use the Information and enjoy Automation.
Thanks
Ankit Kumar