Do we have any Collection action that can remove the duplicate values of a specific field and give me only the unique values?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-03-18 05:10 PM
I am reading values from the excel now I would like to eliminate the duplicate entries of specific field and then give me only the unique values? Is there any Action that can do this work for me ?
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
19-03-18 01:04 PM
Hi Chaitanya,
You'll need to write your own code stage for this in an object:
'IN: Collection_In (as Collection)'OUT: Collection_Out (as Collection)
Collection_Out = Collection_In.DefaultView.ToTable(Only_unique_values_of_columns)
Many more interesting things can be done, e.g. only output certain columns. But i trust that above line of code will already meet your need.
For more documentation, feel free to refer to the official documentation:
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
19-03-18 01:43 PM
P.s. forgot to mention one input value:
'IN: Collection_In (as Collection)
'IN: Only_unique_values_of_columns (as Flag)'OUT: Collection_Out (as Collection)
Collection_Out = Collection_In.DefaultView.ToTable(Only_unique_values_of_columns)
Good luck
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-04-18 05:58 PM
Hi Bastiaan,
The code is working as expected. Thanks for your help !!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
10-04-19 09:45 PM
Hi,
I used above mentioned code stage. However I would like to get an output collection in which not only the column with unique values is present. but also all the other columns from input collection. This because my input collection contains data I need to put in another file. However, I only need to put the values there that are unique regarding one column.
For example:
A 1 R 5
B 1 B 6
B 2 B 6
C 4 R 5
C 3 B 6
If you look at this, I would like to get the unique values from the first column, so only A B and C. But together with the data behind it (concerning the first row value is mentioned), more like removing duplicates in an Excel file. However, with above mentioned code stage I would get a collection out with only A B C in it.
Is there an option to get this done? Except using a loop to get the value and see if this value is already in the ""Unique Value - collection"", and than either adding it to this collection or skipping when value is already present.
Thanks in advance!
Vera
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-04-19 06:10 PM
Paste this into an object, it might be what you're after. You supply the collection and a CSV text of the column names where you want a unique combination of values.
6217b5e5-308c-4c75-b555-28f29403f8e615-306030
Collection_Out = v.ToTable(true, Column_Names.Split("",""))]]>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-06-20 05:36 AM
Hi Bastiaan,
Is there anyway to remove duplicate rows from collection using .net code stage. Suppose I've one collection with 3 columns and if some rows have same data in all of these 3 columns I need to keep only single row(get unique row) and remove others. I've tried the code you shared here. But it is only working if I have a single column collection. Could you please provide your thoughts on this.
Thanks!
------------------------------
Harshali Rane
------------------------------
Is there anyway to remove duplicate rows from collection using .net code stage. Suppose I've one collection with 3 columns and if some rows have same data in all of these 3 columns I need to keep only single row(get unique row) and remove others. I've tried the code you shared here. But it is only working if I have a single column collection. Could you please provide your thoughts on this.
Thanks!
------------------------------
Harshali Rane
------------------------------
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-06-20 06:06 AM
Hi Bastiaan
No need to reply. In this case, we need to just pass the column names (comma separated strings as arguments)in the function basis which we need to remove duplicates. It is tested and verified. Thank you for your initial post. It helped me achieve what I wanted in my current project:)
Thanks,
------------------------------
Harshali Rane
------------------------------
No need to reply. In this case, we need to just pass the column names (comma separated strings as arguments)in the function basis which we need to remove duplicates. It is tested and verified. Thank you for your initial post. It helped me achieve what I wanted in my current project:)
Thanks,
------------------------------
Harshali Rane
------------------------------
