I have an excel file with Multiple Columns. I am using all columns except the first two to find duplicate and distinct rows and then outputting a new excel file with two sheets one for the distinct single data, and one with duplicate data.
My file runs but it not correctly. The outputted file has less rows then the original because certain excel cells get ignored, or not compared correctly. I think it’s due to them containing special characters but I am not sure.
Here is an example
This is the input:
This should be the output for the distinct single data sheet:
This should be output for the duplicated values:
But instead I only get this in the single data sheet:
and this in the duplicated sheet:
All the other rows except the one highlighted in yellow are not included in the outputted file. I don’t understand why the other rows are not in the outputted file while the yellow one is.
This is my Flow:
stringsplit:
row("1").ToString.Split("|"c)
NoDupKeys:
(From r In dtOrigin.AsEnumerable()
Select C1 = r(2).ToString.Trim, C2 = r(3).ToString.Trim, C3 = r(4).ToString.Trim, C4 = r(5).ToString.Trim, C5 = r(6).ToString.Trim, C6 = r(7).ToString.Trim, C7 = r(8).ToString.Trim, C8 = r(9).ToString.Trim, C9 = r(10).ToString.Trim, C10 = r(11).ToString.Trim
Group By C1, C2, C3, C4, C5, C6, C7, C8, C9, C10 Into Group
Select C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, Count = Group.Count
Where Count =1
Select New String() {C1, C2, C3, C4, C5, C6, C7, C8, C9, C10}).ToList
DupKeys:
(From r In dtOrigin.AsEnumerable()
Select C1 = r(2).ToString.Trim, C2 = r(3).ToString.Trim, C3 = r(4).ToString.Trim, C4 = r(5).ToString.Trim, C5 = r(6).ToString.Trim, C6 = r(7).ToString.Trim, C7 = r(8).ToString.Trim, C8 = r(9).ToString.Trim, C9 = r(10).ToString.Trim, C10 = r(11).ToString.Trim
Group By C1, C2, C3, C4, C5, C6, C7, C8, C9, C10 Into Group
Select C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, Count = Group.Count
Where Count =1
Select New String() {C1, C2, C3, C4, C5, C6, C7, C8, C9, C10}).ToList
dtDupKeys:
(From k In DupKeys
Join r In dtOrigin
On k.ElementAt(0) Equals r(2).toString And k.ElementAt(1) Equals r(3).toString And k.ElementAt(2) Equals r(4).toString And k.ElementAt(3) Equals r(5).toString And k.ElementAt(4) Equals r(6).toString And k.ElementAt(5) Equals r(7).toString And k.ElementAt(6) Equals r(8).toString And k.ElementAt(7) Equals r(9).toString And k.ElementAt(8) Equals r(10).toString And k.ElementAt(9) Equals r(11).toString
Select r).CopyToDataTable
dtNonDupKeys
(From k In NonDupKeys
Join r In dtOrigin
On k.ElementAt(0) Equals r(2).toString And k.ElementAt(1) Equals r(3).toString And k.ElementAt(2) Equals r(4).toString And k.ElementAt(3) Equals r(5).toString And k.ElementAt(4) Equals r(6).toString And k.ElementAt(5) Equals r(7).toString And k.ElementAt(6) Equals r(8).toString And k.ElementAt(7) Equals r(9).toString And k.ElementAt(8) Equals r(10).toString And k.ElementAt(9) Equals r(11).toString
Select r).CopyToDataTable
7 posts - 2 participants