Blue Prism Product

 View Only
last person joined: 15 hours ago 

This community covers the core Blue Prism RPA product.

  • 1.  Remove duplicate rows based on 3 column names

    Posted 03-17-2023 01:46

    Hi All,

    Can anyone help me on custom code to remove duplicate rows from a collection based on 3 column names. The input collection has 6 columns in total. i wanted to remove duplicates based on 3 columns.

    Thanks in Advance



    ------------------------------
    Amrutha Sivarajan
    ------------------------------


  • 2.  RE: Remove duplicate rows based on 3 column names

    Posted 03-17-2023 05:00

    Hi Amrutha

    Can you try the below code 

    Dim dt As DataTable = [your DataTable]
    Dim columnNames() As String = inputColumnName.Split(","c) 'replace with your input parameter that contains the column names
    Dim distinctDT As DataTable = dt.DefaultView.ToTable(True, columnNames)

    above code from chat gpt and also refer below thread for better understanding

    Delete Repetitive Values in a collection or Excel | Blue Prism Product

    Hope this helps

    Regards

    Lakshmi Narayana



    ------------------------------
    Lakshmi Narayana
    ------------------------------



  • 3.  RE: Remove duplicate rows based on 3 column names

    Posted 03-17-2023 10:13

    Hi Amrutha,

    Avoidance of duplicates can be achieved in two ways:

    • Removing already existing duplicate values 
    • Avoiding getting in duplicate values 

    While Lakshmi describes how to tackle the first method, you may also consider to have a look at the second method. 

    If your collection data was derived from an XL, you might consider extracting the data using OLEDB using an SQL DISTINCT statement that, if constructed correctly, will only populate the collection with unique data. 

    If you data comes from other sources, you might consider checking if a row to be added to the collection perhaps already exists there. And then not adding it if it appears to be a duplicate.



    ------------------------------
    Happy coding!
    ---------------
    Paul
    Sweden
    ------------------------------



  • 4.  RE: Remove duplicate rows based on 3 column names
    Best Answer

    Posted 03-17-2023 10:23

    Hello Amrutha Sivarajan,

    You can add an action in one of your extended objects for collection manipulations, make sure you have correct external references for Dll and their Namespaces listed in Initialise stage, please follow below approach:

    1. Add an action in existing collection manipulation extended objects or create a new object if not already.
    2. Write Code as below to act on 3 column based duplicate removal in collections:

      System.GC.Collect()
      'filteredCollection=RawData.clone()
      'filteredCollection=RawData.DefaultView.ToTable(true, columnToCheck)
      dim count as integer=rawData.rows.count-1
      dim i as integer =0
      dim rowIndex as integer
      for  rowIndex = rawData.rows.count-2 to 0 step rowIndex-1
          if rawData.rows(rowIndex).item(columnToCheck1)=rawData.rows(rowIndex+1).item(columnToCheck1) and 
              rawData.rows(rowIndex).item(columnToCheck2)=rawData.rows(rowIndex+1).item(columnToCheck2) and 
              rawData.rows(rowIndex).item(columnToCheck3)=rawData.rows(rowIndex+1).item(columnToCheck3)

              rawData.rows(rowIndex+1).delete
          end if
      next
      filteredCollection=rawData.copy()


    3. Check required Dll and Namespaces -if you find any errors (Snippet below)

    Let me know if you find any difficulties implementing this.



    ------------------------------
    Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

    Regards,

    Mukesh Kumar - Senior Automation Developer

    NHS England, United Kingdom, GB
    ------------------------------



  • 5.  RE: Remove duplicate rows based on 3 column names

    Posted 03-18-2023 04:17

    Hi Mukesh

    Thanks for your solution 

    I have tested but their is thing that it is checking for consecutive rows I guess what if their is one row at index like 1 and same is repeated at row index 10 

    I have implemented and tested it but it is not able to remove duplicate rows which are not in consecutive positions

     Can you please check if I am doing any wrong

    Regards



    ------------------------------
    Lakshmi Narayana
    ------------------------------



  • 6.  RE: Remove duplicate rows based on 3 column names

    Posted 03-18-2023 04:33

    Hi Mukesh

    Got the answer from your reply in other thread as first need to sort the collection with any one of the column in the three columns

    Please ignore the above

    Regards



    ------------------------------
    Lakshmi Narayana
    ------------------------------



  • 7.  RE: Remove duplicate rows based on 3 column names

    Posted 03-18-2023 06:43

    Glad you were able to sort that out  ! There was a similar query but for one column value duplicate - Row removal. 

    The only thing that changes in the code is the AND condition operator for column/columns to check.



    ------------------------------
    Kindly up vote this as "Best Answer" if it adds value or resolves your query in anyway possible, happy to help.

    Regards,

    Mukesh Kumar - Senior Automation Developer

    NHS England, United Kingdom, GB
    ------------------------------



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.