0

Script to find and return duplicate records that already exist

Hello, 

I need to delete some duplicate records that have already been imported into my table. Rather than going through and doing it manually, I wrote this formula, but it does not seem to work?

 

if cnt(Vendor_Name) > 1 then "Duplicate" else "Null" end

 

Would anyone know how I can fix this? It seems to be putting the Null in every record, and not picking up the 'Duplicates' to add to those records. 

 

thanks. 

6 replies

null
    • Nick
    • 4 yrs ago
    • Reported - view

    Try this:

     

    let myV := Vendor_Name;
    if cnt(select YourTableName where Vendor_Name = myV) > 1 then
    "Duplicate"
    else
    null
    end

    • wstarnes
    • 4 yrs ago
    • Reported - view

    I'm trying to solve the same issue.  I have tried several formulas but none seem to work.  

    I just tried this formula (modifed for my field and table name) and it is not finding known duplicates.

    Here is my formula:

     

    And here it is NOT giving me a duplicate signal:

     

    What am I doing wrong?  Any help would be GREATLY appreciated! Cheers!

    • Sean
    • 4 yrs ago
    • Reported - view

    It's late for me so maybe I'm missing something, but I think you would need to use the "delete" command in order to delete a record.

    • Sean
    • 4 yrs ago
    • Reported - view

    @Maria, Do you want to automatically mark records as duplicates or delete duplicate records?

    • wstarnes
    • 4 yrs ago
    • Reported - view

    Hi Sean,

    For what it's worth, I'm wanting to "mark" the duplicates so I can review each and determine which of the duplicates I want to delete as there is other data in the records I'm wanting to preserve.  Thanks!

    • maria_kay
    • 4 yrs ago
    • Reported - view

    @Nick it worked! Thank you! @wstarnes here is my snapshot, it worked for me! The only issue I think is when I delete the duplicate, the record that remains is still marked 'duplicate'.

     Screen Shot 2020-01-20 at 23.59.05

     

    @sean, I wasn't keen on automating the deletion. I prefer to mark the duplicates and review them before manually deleting, exactly like you. 

     

    thanks all

Content aside

  • 4 yrs agoLast active
  • 6Replies
  • 1810Views