- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-03-20 12:06 PM
I have action which remove duplicated rows in whole collection.
Collection_Out = Collection_In.DefaultView.ToTable(True)
I want to write new action which remove duplicates value only in specific column.
Does anyone have solution for this?
Thank you in advance
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
Answered! Go to Answer.
Helpful Answers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-03-20 08:05 AM
Dim c As Integer c=Cint(cNumber) Collection_Out = Collection_In.AsEnumerable().GroupBy(Function(row) row(c)).[Select](Function(group) group.First()).CopyToDataTable()
Add cNumber as Number Input referring to column number starting from index 0
ALso add following to Imports
------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-03-20 01:18 PM
Hi, Mateusz.
You can try to use the asset from Digital Exchange called Millicom – Collection Utility.
You can find the action the extract unique values (or remove duplicates) from a collection and other nice actions to work with collections.
|
------Original Message------
Hello,
I have action which remove duplicated rows in whole collection.
Collection_Out = Collection_In.DefaultView.ToTable(True)
I want to write new action which remove duplicates value only in specific column.
Does anyone have solution for this?
Thank you in advance
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-03-20 01:26 PM
or you can choose to write a code stage as well.
------------------------------
Ishan Mahajan
India
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-03-20 01:42 PM
Ishan Mahajan thank you for this solution.
I am wondering if there is a way to extand code Collection_Out = Collection_In.DefaultView.ToTable(True). This will contains less stages. than looping through whole collection.
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-03-20 01:43 PM
I think you can use DISTINCT to get the result you need.
Try it and lets see if works.
|
------Original Message------
Raúl Hernández I do not see those actions in Millicom – Collection Utility. Please see attachment
Ishan Mahajan thank you for this solution.
I am wondering if there is a way to extand code Collection_Out = Collection_In.DefaultView.ToTable(True). This will contains less stages. than looping through whole collection.
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-03-20 02:04 PM
I lost others columns.
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-03-20 03:14 PM
I understand.
In that particular case, you can use a simple loop logic to get unique values from the collection.
Simple loop logic should use
- A mirror collection, to compare all elements.
- A new collection to store unique values (entire row).
- A loop inside other loop, to compare all elements.
- a Flag to identify if the element already exist in your new Collection.
This logic is high time consuming depending of the numbers of rows in your collection, but it will work.
|
------Original Message------
DISTINCT action return a collection with unique values and column counter
I lost others columns.
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-03-20 06:42 AM
I am looking for less time consuming way, like extanding code Collection_Out = Collection_In.DefaultView.ToTable(True) by additional argument or additional line.
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-03-20 08:05 AM
Dim c As Integer c=Cint(cNumber) Collection_Out = Collection_In.AsEnumerable().GroupBy(Function(row) row(c)).[Select](Function(group) group.First()).CopyToDataTable()
Add cNumber as Number Input referring to column number starting from index 0
ALso add following to Imports
------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-03-20 01:02 PM
This is want I was looking for.
It works.
Thank you very much.
------------------------------
Mateusz Wojcik
RPA Programist
Rockwell Automation
Europe/Warsaw
------------------------------
