Hi, I could really use some help. I have a data table that I need to modify when there are duplicates in the ID column.
The data looks like this:
Number
Locale
ID
Date
Area
123
A
312
17/05/2024
UK
213
B
312
17/05/2024
UK
789
A
879
14/03/2024
US
986
B
879
14/03/2024
US
912
C
879
14/03/2024
US
Where there are duplicates i’d like to concatenate the value that is in the Locale column with the Number column. Once thats been updated, Locale needs to be updated to the letter J so the output looks like this:
Unable to share the files due to restrictions but you should be able to recreate it with the detailed screenshots and expressions shared. Do let me know if stuck somewhere.
I was also working for your solution, I have a different approach with a single LinQ
LinQ:
dt_Output = (
From row In dt_Input
Group row By id=row("ID").ToString().Trim(),datee = row("Date").ToString().Trim() ,area=row("Area").ToString().Trim() Into grp=Group
Let Number = String.Join(" ", grp.Select(Function(x) String.Concat(x("Locale").ToString(), x("Number").ToString)))
Let Locale = "J"
Let IDValue = id
Let DateValue = datee
Let AreaValue = area
Select dt_Output.Rows.Add({Number, Locale, IDValue, DateValue,AreaValue}.ToArray())
).CopyToDataTable()