Remove duplicates from entity with multiple attributes

data is as below in the entitiy ops1,env1 ops2,env2 ops3,env3 ops1,env4 ops2,env2 ops3,env3 ops1,env1   after removing duplicates it should have only 4 rows ops1,env1 ops2,env2 ops3,env3 ops1,env4 i did a retrieve of the data into a list, did a union of the list onto the same list , but i dont see the result.
2 answers

A union does remove duplicate objects. If the objects are different but the values are duplicates of each other, a union will not remove the duplicates. Since your list is retrieved from the database, there will not be any duplicate objects. A retrieve always returns each object once, never twice.

You need custom logic to identify your duplicates and you need to decide which version to keep and qhich to delete.

You also need a delete action to delete the duplicates. Committing the obhects that you keep will not remove the ones you don’t keep.


Here is how its fixed for me ,  Added both the columns ( concatenated) as a third column.

Used that third column as a list  to reiterate/loop and resolve duplicates as in document below.

Now i have unique rows of 2 columns.

This can fixed ‘n’ number of columns by concatenating as third column.