Data fetching and Grouping

I have attached the files below along with the dummy input in it. Files named one,two and three are my input files and file named four is the output file I want. now if a name exist in file one 2 times in file 2 1 time and in file three 1 time then in file four I should get all these 4 entries of same name first and then it should go for the second name from file one. Refer the attachment so that my question would be more clear to you all. Only the name is the common element in all the files and the data in the roa of each name may differ so It should get the data of complete row of that name and group together. For example all the entries for name pankaj from all the three files should come one after another together in file four. after that it should take the second name for example it is pranjal then it should take all entries of pranjal from all the three files and paste it into file four. Please help me with a proper solution for this scenerio at the earliest if possible.

Thanks in advance,
Pankaj

four.xlsx (8.2 KB) one.xlsx (7.9 KB) three.xlsx (7.9 KB) two.xlsx (7.9 KB)

Hi @Pankaj7
Use Build Datatabke
and pass add data row based on for each or datatable.select

Thanks
Ashwin S

I tried it but it did not work. Did you check the attachments? you will understand better what scenerio I am talking about through it so.

I had shared this problem by other title also but did not get any response on it yet. I have four different files and want to take data from all files and put it into the fourth but by grouping the data of same names together. Please go through the files once and let me know if you get any solution.

yes

Do One thing

Use it based on Directory.GetFiles(inputfilepath)

Use Datatable.Select("[ColumnName]<>’’ or [ColumnName]<>’’").CopyToDatatable

You will get this as Dt
use for each row and use add data row

Likewise loop it for different excel
Thanks
Ashwin S

I don’t need only columns. I actually need complete row data of the entry for each name and same goes for each file but only the name column is the common thing that is present in all 3 files remaining columns are different.

Hi @Pankaj7
in that case loop all the rows in Datatable by using for each

in the last datatable use this as

Dt.DefaultView.ToTable(“True”,“Name”).ToString

Thanks
Ashwin S

But will this also give me the desired format as shown in file name four?
It should give me the grouped names as output

Thanks @AshwinS2 but I guess I have got an simple solution for my problem.
I have attached the .xaml file of the solution for others facing same issue. Hopefully this helps.

Thanks,
Pankaj

Main.xaml (27.1 KB)

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