siming
March 12, 2020, 7:26pm
#1
I have a list of numbers, as a column in a datatable: it looks like this:
1
2
3
4
4
5
5
6
7
I need to separate the items that are duplicated and store them in a separate table, so eventually i would have 2 tables that look like this:
1
2
3
6
7
and
4
4
5
5
What’s the best way to achieve this?
Thank you!
ppr
(Peter)
March 12, 2020, 7:45pm
#2
@siming
Have a look Here
@Hisuhong
find attached sample seperating the Duplicates and NonDuplicates and writes out into 2 different Worksheets
Hisuhong.xaml (10.0 KB)
Result for Reference: Result.xlsx (9.1 KB)
the main Ideas were to Identify the Duplicates / NonDuplicates on its occurence validating the 4 columns
this was solved with using the Keys for a GroupBy and Count
E.g. NonDuplicates:
(From r In dtOrigin.AsEnumerable()
Select C1 = r(0).ToString.Trim, C2 = r(1).ToString.Trim, C3 = r(2).ToString.Trim, C4 =…
Hi @arivazhagan_mathivan
I did reread all the posts and confirm to @amaresan . Based on your second table all N are to remove. And this would be the simplest (e.g. FilterTable or LINQ)
Let me reformulate your requirements, maybe you are looking for some different:
If a N row ABI # Value exits in a NON-N row ABI # Value then we got a Duplicate
Mission: remove the duplicates (means N rows)
[grafik]
N-AA exists not in NON-N so keep, Keep Y-DD as well, Keep NON-BB,CC
Remove N-BB, N-CC
So this…
@kuppu_samy
Below a more detailled description on how to do (1 column, List approach)
[grafik]
Build Datatable - just simulating Excel readin, giving a Datatable
1. Assign: creating a string list from the Numbers column
dtData.AsEnumerable.Select(Function (row) row(“Numbers”).toString.Trim).toList
2. Assign: retrieving the duplicates:
(From s In Numbers
Group s By no=s Into Group
Select no, count=Group.Count
Where count>1
Select no).ToList
3. Assign filtering out the dplicates from…
Let US know your Open questions
siming
March 12, 2020, 8:07pm
#3
Is it possible to not use AsEnumerable at all? I tried adding it to the xaml document in a note pad but I still get a error telling me it’s not part of the datatable function
ppr
(Peter)
March 12, 2020, 8:10pm
#4
Can you please Help us on giving some more Details. The Part with doing IT Notepad is unclear in Detail. Thanks
Have a Look Here as Well
When trying to use the AsEnumerable() method on a data table, i receive a error stating that AsEnumerable is not a member of ‘System.Data.Datatable’. I’ve seen someone else with this problem and their solution was to use temporary data table activities in their project to load in the System.Data.DataSetExtension library. However this has not worked for me. Any help would be greatly appreciated.
Thank you.
siming
March 12, 2020, 8:16pm
#5
This was the post that i followed to add the AsEnumerable() method, but it didn’t work. I still can’t use AsEnumerable() in my workflow
ppr
(Peter)
March 12, 2020, 8:19pm
#6
@siming refer to my Edited Post above. Here you can find a description to make asenunerable available
Like this:
Processusvierge.zip (8,0 Ko)
2 Likes
siming
March 12, 2020, 8:46pm
#8
It worked exactly how i needed it. Thank you very much!!
system
(system)
closed
March 15, 2020, 8:46pm
#9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.