How to use invoke code to transfer duplicate entries to from main data table to new data table

Hello guys ,

Please i have datatable 1 with a column called “EXTRENAL REF” . i want to transfer all rows that have the same EXTERNAL reference into a new data table so that data table 1 only has data with unique references.
I would love to achieve this using an invoke code.

Please any ideas.
Thanks guys.

@David_Oku Any specifi reason to use invoke code here ?
This can be achieved via linq and assign activity.

1 Like

okay thats great , i just wanted to see how invoke code would work with that. But let me see the linq please. Currently i am using the worst method ever, I write to an excel and perform a v lookup operation and last i read range again, but this is a very long method and takes a lot of time…i would be glad if you tell me about liq

@David_Oku

uniqueRef=(from dr as datarow in dt select dr.item("EXTRENAL REF")).distinct()
This will give you unique reference of External Ref.

That’s second part of the statement
for each i in uniqueRef
{
(from dr as datarow in dt1 where d.item(“EXTRENAL REF”).trim.equlas(UniqueRef(i) select dr).copytodatatable
}

2 Likes

okay please whats the variable type for unique ref

System.Collections.Generic.IEnumerable<System.Object>