1443
Views
7
Comments
Solved
How to check duplicates in list - OutSystems 11
Question

Hello All,


I am having list of structure and I want to validate the list if it has any duplicate value.


Any one having any suggestions. I was trying to use foreach loop but not sure how I should implement. 

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi Neeraj,

1. Sort the list.

 2. For each on sorted list

3. Compare current with previous element [current -1]

4. If current equals previous you have a duplicate

Regards,

Daniel


2026-02-26 06-29-24
Rahul
 
MVP

Hi Neeraj,

You can use ListDuplicate action -

see below image



Regards

Rahul

UserImage.jpg
Neeraj

Rahul Sahu wrote:

List Duplicate action will duplicate the list in another list. I want to validate the list if it has any duplicate entry see below example:


List 1 - 1,2,3,2,4

Duplicate entry = 2


How I can achieve above ?



Hi Neeraj,

You can use ListDuplicate action -

see below image



Regards

Rahul

 

 

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi Neeraj,

1. Sort the list.

 2. For each on sorted list

3. Compare current with previous element [current -1]

4. If current equals previous you have a duplicate

Regards,

Daniel


UserImage.jpg
ASHISH SOLANKI

Daniël Kuhlmann Could you please explain in a detail or create a oml as you suggested.  

2023-03-09 17-04-45
Nivaldo Pereira
Champion

2024-03-06 08-19-06
Rean Lubbe

I have had the same issue but resolved it in what I believe to be a simpler way.

1 - Use the ListDistinct method from the System component on the list that we wish to check.
2 - If the output list of the ListDistinct has fewer records than the original, then there were duplciates.
3 - provided there are duplicates and it is necessary to identify these, follow the process as laid out by @Daniël Kuhlmann (I don't need to so I just put in an error message). Using the first two steps just lets us avoid cycling through every list item unless we know there is a duplicate that needs to be found.




2025-12-29 06-17-15
Deepak Raj M

Hi, without foreach are any loop use can use list duplicate available in manage dependency-systems you can find  list duplicate there

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.