Use For Each Row

Attached SS Of Current data table format and expected data table format

How can we get the division from data table that is US and Canda along with their file names only once
After that we have to use for each activity (Only Once for each division)

Hello @anmita

Does that mean we need to get the first entry of each division? Because here in the table the rows are not duplicate and what should be the criteria for selecting the row?


Hi @Rahul_Unnikrishnan
Yes Right we need the division and filename only once(Does Not matter which entry is considered)


I think you can use “Remove Duplicates” activity and provide the columns to compare.



Hi @Rahul_Unnikrishnan
Let me try
Are there any other way to do it

Thanks for the quick response!!!

Another approach is using the expression as below.

MyDt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“Name”)).Select(Function(g) g.First).CopyToDataTable



1 Like

Hi @anmita,

As per my understand you have filtered “Division” Column if I’m right try below workflow




For Each Row in Data Table

Add Data Row



Hi @RajKumar_DC
Thanks for the Quick Response!!!

The thing is while I am trying to filter am getting duplicated Division values.

Any approach that we could use so that if for example US is present more than 1 time then any one row should be considered

Thanks and Regards

Hi @anmita,

Greetings of the day!

first get ‘DefaultView’ value from Division column. then try above mentioned workflow

@anmita Please check this one I have written for you.
For your case, I used a collection to store the Division. Then I loop through the data table and if the division name is not in the collection, I add that division name into the collection else, I remove the data row from the input data table. In the end, you will get only the first occurrence of each division. I hope it solves your problem.

Best Wishes, (16.3 KB)

Hi @anmita

How about this expression?

(From d In DtBuild.AsEnumerable
Group d By k2=d(2).toString.Trim Into grp = Group
Let ra = New Object(){grp.First()(0),grp.First()(1),k2,grp.First()(3),grp.First()(4)}
Select r = DtClone.Rows.Add(ra)).CopyToDataTable

Check out the XAML file

GroupByDivision.xaml (6.6 KB)


Thanks @DarDarSara for reference

Thanks @Gokul001 for the solution

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