remove duplicate entries in a queried list

i am using a query to import sales order numbers and i need to delete the duplicates. i tried doing the union upon itself but it didn’t work, i think it may have something to do with my data.  following the steps in this forum: i began creating a miroflow but it still is ineffective. i’m still learning loops, so can somebody please review my microflow and let me know how i can fix it?  
1 answers

For starters: Looking at the name of the loop's iterator, it looks like you are iterating over SOnumberlist, but you need to iterate over ListOfSalesOrdersNumbers.

ListOfSalesOrdersNumbers needs to be ordered by the key field(s).

Before the loop create a LatestSalesOrdersNumbers-object

In the loop:

  • a decision: Compare Iterator against LatestSalesOrdersNumbers-object,
  • if ‘the same’: add Iterator to the ‘list-to-delete’
  • if ‘not the same’: store iterator’s values in LatestSalesOrdersNumbers