I have an inquiry regarding in checking if the records have duplicates… (Filters are First name, Last name, and Company) and I need to put comment such as ‘Duplicate Entry 1’++… Appreciate your help!
Duplicate Entry 1
Duplicate Entry 2
Duplicate Entry 3
Duplicate Entry 4
The general method is to use for each loop with the of condition.
But to simplify the following steps can be used…
The above table is in Dt.
Clone the Dt
For each loop.
Filter the condition and update comments to the new filtered Dt.
Add the data rows of filtered-dt to the clonedt.
Remove the datarows from the Dt.
This might be better than the general one.
Once you have read the excel with column
ID First Name Last Name Age Company Location Comment, say output in DT1
Now get distinct Values from the excel based on your filter
`DataTable (DT2)= DT1.DefaultView.ToTable(true, “First Name”, “Last Name”, “Company”)
Now loop through DT2,
Inside loop use Linq Query
Array of datarow (Z) = (From r in DT1.AsEnumerable.where(function(x) convert.tostring(x(“First Name”)) = Convert.tostring(row(“First Name”)) and convert.tostring(x(“Last Name”)) = Convert.tostring(row(“Last Name”)) and convert.tostring(x(“company")) = Convert.tostring(row(“Company”)) ) select r).toarray
use if to Check z.count>0 , if yes then
Use for each and loop through Z
assign counter= 1
and update the comment with counter as dynamic
Hello! Sorry but im not familiar how to use linq. Is there any other way to do it? I also want to put the comment in the same excel file, not create a new one… Thank you!!
Would you please be able to provide a sample xaml for this? Thanks! I understand the logic you said but I don’t know how to apply it… Thanks again
March 12, 2020, 8:12am
Check this workflow and output file,
Excel_Automation.xaml (15.5 KB)
and Updated_Comment.xlsx (7.4 KB)
Thanks for this
@Manish540 Will check this and let you know!