How to merge two data tables

hi
To merge two data tables I’m using merge data table. I have to merge table1(2rows and 4 colums) with table2(1row 1column) but the output is like it is passing null values upto table1 rows in table1 and appending new rows of table2 in table1. finally table1 has(3row 5columns) instead of the i need table1 with 2rows and 4columns

2 Likes

Can you be more specific about the columns? Does the two tables have a common column name.If not, output will have 5 columns.

Sry output should be 5 columns bt row should be 2 rows… ex table1 has 2 rows and 4 columns and table2 has 2 rows and 1 column… if I merge it, table1 is having 4rows and 5 columns… 1st two rows in column5 is empty… I need 2 rows no null values

In that case you don’t have to merge data tables, add new column to table 1 and update table 2 rows.

1 Like

i used add column and for adding row if i use add row means then previous data in table1 is getting lost

Can you share your code(xaml)?

table.xaml (13.8 KB)

hey @Sunitha_Bist

we can merge two tables into a single table but you should know some points before merging:

**If the number of columns do not match the second table*

  • When the number of columns do not match the second table then it creates blank columns for the table for the column(s) that do not match, as in the following:

If the data type of a column does not match the second table

  • The data types must match. If the column names are the same and if the column name in both tables are the same and the data type is different then it shows the error.

If the column name does not match any in the second table

  • If a column name does not match in the second table then it creates records with a blank in each column that does not match and keeps their own orignal column names.

after this understanding please find this attached sample workflow and let me know :slight_smile: if still you have some doubts on this.

table.xaml (14.4 KB)

Regards…!!
Aksh

5 Likes

Tq aksh1yadav but instead of mergetable can i use any other concept which will update my table table with new column and rows like in the picture

Hi @Sunitha_Bist

to achieve this what data you are getting into datatables?

in table1(Name:abc,def and city:xxx,yyy) and in table2(country:abcd,efgh)…but now im getting like table1(Name:abc,def and city:xxx,yyy and country: , , abcd,efgh)… i need final output like in table1(Name:abc,def and city:xxx,yyy and country:abcd,efgh)…

output is like


but table1 will have rows like Name:abc,def and city:xxx,yyy… it is showing only the last row

@Sunitha_Bist My idea is similar to the attached code. You can tweak it a bit as per your requirement.

merge.zip (19.9 KB)

4 Likes

Thank you vvaidya… it worked for me…
can you please explain me the flow… because im new one in uipath…