Here is my use case, I have the following DT
[Emp Id,Emp Name,Region,Region_From_DT2,Comments(c1=D1)
1001,Uma Sekh,Ind,Ind,
1024,Prabhash Ali,UK,Ind,
1178,Akram Kapoor,US,US,
]
the last column would be updated as True or False based on columns “Region” and “Region_From_DT2” matching
I tried this query
(From row In dtOutput Let A=If(row(“Region”).ToString.Equals(row(“Region_From_DT2”).ToString),“True”,“False”) Select dtOutput.Rows.Add(row(“Comments(c1=D1)”),A)).CopyToDatatable
I am getting the following error
“Assign: Collection was modified; enumeration operation might not execute.”
What would be the solution for this? I want to skip the for each loop activity.
For each row as datarow in Dt.asenumerable
If(row(“Region”).ToString.trim.Equals(row(“Region_From_DT2”).ToString.trim) Then
row(“Comments(c1=D1)”)=“True”
Else
row(“Comments(c1=D1)”)=“False”
End if
Next
I have used this query
dtOutput.AsEnumerable.select(function(a) dtOutput.clone.loaddatarow({a(0).tostring,a(1).tostring,a(2).tostring,a(3).tostring,if(a(2).tostring.trim.equals(a(3).ToString.trim),“true”,“false”)},false).CopyToDataTable
still getting the same error, would you check please?