Delete duplicated Items

Those anyone know of a nice action that can delete duplicated inputs in a list?

1 Like

Hi Brendo,

I might actually have two.

1. Use excel import and export
Create an overview of all items in your data-item and make it exportable. Make sure you include all items and all attributes in the list. Also make sure you have a unique identifier in your data-item. Then create an import function for the data-item. In the dialog, select the “Import and delete” option as shown below.
image
In the next screen, select “Do not allow duplicates”:
image

Once you have published your overview, use it to make an export of all entries. Create a copy of the file, to retain a back-up of your data, in case something goes wrong. Use Excel to remove any duplicates. Then import the excel back into Triggre, using the import function. Alle duplicates you have removed from the Excel file will be also be deleted in Triggre.

2. Use a buffer data-item
Create a data-item with the name “Buffer” or some other name of your choosing. Add the same attributes (name and data-type) as the ones that help you identify any duplicates.
Example: You have a data-item called “Relation”, which contains the attributes Name, Address, City, postalCode and dateOfBirth. The combination Name, City and dateOfBirth should be unique, so any record containing the same combination is a duplicate. Create an new data-item with the name relationBuffer and add the attributes Name, City and dateOfBirth.

Now create a flow part that selects all records in your data-item and then runs through them:


In the repeat action, you search for any buffer (empty selection) that matches the same combination of attributes. If found, the current record is a duplicate. If not, the record is unique and should be added to the buffer. Like this:

> Beware to clear the Buffer data-item each time before you run this procedure, otherwise all your records will be gone! Do a dry run (before adding the delete) before you do the actual run.

It is up to you to make the choice which option works best for you and depending on your situation and the complexity of the combination of identifying attributes and any used references you might run into some challenges when doing this. Removing duplicates is always a tricky business, as I am sure you know.

Anyway, hope this helps!

EDIT: Just got another idea. Instead of immediately deleting a probable duplicate you might want to consider adding a yes/no attribute to your data-item named “Duplicate”. Replace the delete action in the 2nd example with an edit action to set the attribute to yes. Once done, you can manually browse through all records with a ‘yes’ to do a manual check before you delete any record.

4 Likes

Hi Sylvester, thank you for the detail explanation, this was very helpful.

1 Like

Warning: advanced stuff coming up :slight_smile:

Just a quick note about how Triggre handles lists of data items; any action that results in a list of data items that may contain duplicates, will remove those duplicates automatically. This is only true for data items, not for texts or numbers.

I have attached a very simple test that shows this behavior. Load it and publish it, then simply add some items by clicking Add and then go to the List test page. It will show you how Triggre handles such lists in a bit more detail.

List test.triggre (18.1 KB)