Blue Prism Product

 View Only
last person joined: 21 hours ago 

This community covers the core Blue Prism RPA product.

Expand all | Collapse all

Collection - Remove Duplicated Values in Specific column

  • 1.  Collection - Remove Duplicated Values in Specific column

    Posted 03-04-2020 12:06
    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
    ------------------------------


  • 2.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-04-2020 13:18

    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.

     

     

     

     Signature Label 3

     

     






  • 3.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-04-2020 13:26
    Good Suggestion by Raúl Hernández, and if you are not allowed to import a VBO, you can sort your collection on the the same field where you expect duplicates, and run a loop on it as long as you find the currentrow.column value = lastrow.cloumn value, you can delete the current row.

    or you can choose to write a code stage as well.

    ------------------------------
    Ishan Mahajan
    India
    ------------------------------



  • 4.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-04-2020 13:42
    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
    ------------------------------



  • 5.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-04-2020 13:43

    I think you can use DISTINCT to get the result you need.

     

    Try it and lets see if works.

     

     Signature Label 3

     

     






  • 6.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-04-2020 14:04
    DISTINCT  action return a collection with unique values and column counter 
    I lost others columns.
    Please see attachments


    ------------------------------
    Mateusz Wojcik
    RPA Programist
    Rockwell Automation
    Europe/Warsaw
    ------------------------------



  • 7.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-04-2020 15:14

    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.

     

     Signature Label 3

     

     






  • 8.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-05-2020 06:42
    Raúl Hernández thank you for this solution.

    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
    ------------------------------



  • 9.  RE: Collection - Remove Duplicated Values in Specific column
    Best Answer

    Posted 03-05-2020 08:05
    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
    ------------------------------



  • 10.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 03-05-2020 13:02
    Hi Gopal Bhaire

    This is want I was looking for.
    It works.

    Thank you very much.

    ------------------------------
    Mateusz Wojcik
    RPA Programist
    Rockwell Automation
    Europe/Warsaw
    ------------------------------



  • 11.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 07-02-2020 11:25
      |   view attached
    i have try your code but i got error, can you help me

    ------------------------------
    IAN NUGI
    ------------------------------



  • 12.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 07-02-2020 13:48
      |   view attached
    Hi IAN NUGI,

    I send word document where you can find whole page from object.
    Please paste it in your object Utility - Collection manipulation.

    Please let me know if it works


    Kind regards

    ------------------------------
    Mateusz Wojcik
    RPA Programist
    Rockwell Automation
    Europe/Warsaw
    ------------------------------

    Attachment(s)



  • 13.  RE: Collection - Remove Duplicated Values in Specific column

    Posted 07-03-2020 07:42
    Hi,
    I can share my code regarding removing duplicates:
    Create a code stage.
    input:
    <type collection> Input name: CollectionIn
    output:
    <type collection> output name: CollectionOut
    <type text> ErrorMessage 

    ErrorMessage = "";
    CollectionOut = new DataTable();
    DataTable dt1 = new DataTable();
    try
                {
    
    
                    dt1 = CollectionIn;
    
                    DataTable dtMerged = dt1.AsEnumerable()
    				.GroupBy(r => new {d= r.Field<string>("put here column name from your collection") })
    				.Select(g => g.First()).CopyToDataTable();
                    CollectionOut = dtMerged;
                }
    				catch (Exception ex)
                {
                    ErrorMessage = ex.Message.ToString();
                    
                }

    Namespace Imports:
    System.Linq
    System.Reflection
    System.Collections.Generic

    External References:
    System.Linq.dll
    System.Data.Common.dll
    System.Core.dll
    System.Data.DataSetExtensions.dll

    Hope this will help:)



    ------------------------------
    MIROSLAW GADEK
    CI & QUALITY MANAGER DACH
    Schneider Electric Operations Consulting GmbH
    Europe/Berlin
    ------------------------------



Welcome to the Blue Prism RPA Product Community!

Whether you’re looking to manage a complex infrastructure, maintain security and compliance, bring new products to market faster, or gain operational speed and agility in an uncertain economy, Blue Prism delivers — with the flexibility you need to create the business you want. From deployment on-premise, through a cloud service provider or as SaaS, to a skillful and adaptable digital workforce that continually expands to meet your enterprise needs, you can gain enhanced operational insight and control while your people reclaim the time they need to focus on great work.

Product PageKnowledge BaseBlue Prism Training Offering
Product Research ProgramUpdates, Releases & Announcements

FAQs

Blue Prism is intelligent automation — business-developed, no-code automation that pushes the boundaries of robotic process automation (RPA) to deliver value across any business process in a connected enterprise.

A combination of RPA with expanded cognitive and AI capabilities, Blue Prism is different than other automation technology on the market. With one Blue Prism license, you gain instant access to an already AI equipped digital workforce, along with the tools you need to build and delegate automations. Click here for more information on Blue Prism and Intelligent Automation.
To learn more about how Blue Prism RPA can help your organization and how much it will cost to get started, please Contact our Sales department.
Blue Prism RPA can be downloaded from our customer portal. If you would like to consume or download any material it is necessary to create an account on the Portal. Once you have registered, you can access the download options for Blue Prism here.
Yes! Installed on your own machine and supported by our training materials and product documentation, you can use all the features of the full enterprise product for free with our Blue Prism Trial – giving you the opportunity to learn the basics before moving to a full production implementation. Click here for more information and to download the trial.
Yes! You can access our known issue list for Blue Prism from our Support Portal.
Regardless of your industry, Blue Prism’s Digital Workforce can adhere to strict governance and compliance standards without limiting productivity. Click here for more information on how your industry can benefit from Blue Prism.