Join Data Table giving Dublicate values

Hy
i m joing two data tables DT1 and DT2 using join datatable and inner
and getting the out put as DT3

but in dT3 i m finding most row has been duplicated without any reason
i m trying to get the same value based on two different columns in 2 DATATABLES

Hi @Tharusha_Fernando

Can u show how u want as output and output u are getting as of now ?

hi @NIVED_NAMBIAR plz find the excel sheetgoods.xlsx (11.4 KB)

@Tharusha_Fernando
refering the excel sheet output: it looks correctly in the sense / working mode of the join datatable.

For some introduction onto the Join datatable concept have a look here:

1 Like

@ppr when i using this with inner some data row get duplicates’ after joining do you know why is that

Hi @Tharusha_Fernando

I am getting same issue of duplicates

why so? @ppr any reason for this ?

well i had tried it using linq query and it works fine

check this

Main.xaml (8.5 KB)

Hope it helps you

Regards

Nived N

Happy Automation

1 Like

@Tharusha_Fernando, @NIVED_NAMBIAR

the nature / working mode of the join is as following:

  • combine the columns from dtLeft with the columns from dtRight
  • build pairs according the join type and join condition
  • (Short explanation - Join Datatable Activity:) make duplicated column names unique by appending_1

so looking at the result (I did implemented additionally for cross check) is is valid:

Product Account ID2 Amount Pan Merchan Pan
Apple 10010222540 5 444 10010222540
Sugar 10010224010 3,6 555 10010224010

we dont have duplicates on row level:

  • there are 2 matches for the inner join

we dont have duplicates on col level

  • there is no column occuring multiple time

Yes, we do see eg. 10010222540 two times but under the different Columns (dtLeft: Account ID2, dtRight: Merchan Pan)

it is usually to do remove the unneded columns after joining by e.g. filter datatable, DataTableVar.DefaultView…

@NIVED_NAMBIAR the reason why your LINQ Result doesnt have Account ID2 and Merchan Pan is because of the value selection into the new rows Object array. But as it was done manually and it is not a out of box behaviour and similar to filter datatable-remove column action.

the resulting JoinIterator also have the same result, all cols from dtLeft and dtRight:

2 Likes

Thanks buddy @ppr for the superb explanation :heart::heart::heart::heart::heart:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.