Grouping Data on Excel Based on Data and Crosscheck Data

I want to group data based on the Collection_No and want to do further work on them like, crosschecking with a similar excel sheet, providing flag mismatched entry.

How may I perform this action?


In this case, I recommend to use Dictionary(Of String, DataTable) as the following, for example.

dict = dt.AsEnumerable.GroupBy(Function(r) r("Collection_No").ToString).ToDictionary(Function(g) g.Key,Function(g) g.CopyToDataTable)

Sequence3.xaml (7.6 KB)


@Yoichi thank you but can you please help me to generate a output from the following xaml?

I want to print it in the console initially, then I will write on excel

sharing the sample excel here
sample_excel.xlsx (11.6 KB)


How about the following? (11.8 KB)


1 Like

thank you @Yoichi

this is almost exactly how I want to get things but I want the Collection_No’s as individual datatable rather generating them as individual excel file.

how may I get them as individual and dynamic datatable, can you please help me with that?


I think it’s difficult because we cannot make variable name dynamic. Is there any problem if use Dictionary? In most case, it will work.


Assign Activity:
TableList | DataType: List(of DataTable) =

(From d in YourDataTableVar.asEnumerable
Group d by k=d("Collection_No").toString.Trim into grp=Group
Select t = grp.CopyToDataTable).toList

As similar
Assign Activity:
TableList | DataType: List(of DataTable) =

 YourDataTableVar.asEnumerable.GroupBy(Function (x) x("Collection_No").toString.Trim).Select(Function (g) g.CopyToDataTable).toList

if I can store this value in a datatable with the same column name of the excel file, then it will be easier for me to implement my process



can you help designing me this assign activities in this xaml? (11.8 KB)

In general you are well supported by @Yoichi and we would recommend to stay at one approach and bring it to the final solution.

For the last step just redefine your exact requirements for the expected and output and we will help for this.

  • The dictionary approach from Yoichi allows you also to retrieve all seperated datatables as Datatable: YourDictVar.Values.ToList

  • You can implement as mentioned above as the table list

  • And also you can set a table name to the Datatable and reflect with this the group key

As you see there are many variations. All is now about fixing the requirement and needs

1 Like

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