How to add all columns of a specific row into a data table

I have two table named A and B.
A
Key Name class roll
1 Raj VI 1
2 Rahul VII 5
3 Ravi IX 4
4 Sourav X 2

B
Key Name class roll age city country
2 Rahul VII 5 12 Kolkata India
4 Sourav X 2 15 Milan Italy

Now I want to join these two table based on key and keep all the rows from both the table but keep same column only once. Like my output table structure will be,

Key Name class roll age city country
1 Raj VI 1
2 Rahul VII 5 12 Kolkata India
3 Ravi IX 4
4 Sourav X 2 15 Milan Italy

How to get this desired result using datatable?

Hi welcome to the community!
You can do like this:
image
And after you need code to remove the extra columns like this:

1 Like

May I ask why you used Contains(“1”) in the IF condition? I don’t get the logic.
And also .dt3.Clone.Columns.
PS. I am a newbie.

When you do the Join, if the tables have columns of the same name, uipath will maintain both the columns but it will add like “Name_1”, “City_1”, but i assume you wont need to have to columns repeated in your final table, so that will remove them. That clone thing is so that we can remove the columns from the final table inside a foreach, without it you would get an error for trying to change the structure of the table while looping it…

1 Like

As an altrnate to the invoke method also the remove data column activity can be used on dt3

2 Likes

Hi,

Using full join I am getting table like this in excel.

And removing rows from the table is not givving the desired output.

One thing is that your are not removing the extra columns…