- 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Removing Duplicate Values From a List
- Updated on 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.9.2 |
Root Folder | Example Lab - Remove Duplicate Items from a List |
Modules | None |
Dependencies | None |
This Example Lab project demonstrates how to filter through a List and remove any duplicate values.
Explanation
The Remove Duplicates Flow checks field 1 and field 2 for duplicates. The List item will only be removed if both fields 1 and 2 are a match for another List item. This works by using a ForEach Step to iterate between each List item individually. The first item is added to the new unique items List by default to avoid checking against an empty list, but every item after that is only added if it does not already exist in the List. This is accomplished using a Rule that determines whether the items in field 1 and field 2 already exist as a List item. If one or both field values do not already exist the item will be added to the List. In order to test this Flow, there is a unit test provided in the Debugger that can be run as an example.