Get the first duplicate item from array and delete it

Hi,

I am struggling with the following request - I have an array of users which contains duplicates (which is desirable). When I call a specific API endpoint, I need to remove one of the duplicates (if duplicates exist, if not then delete the unique record) but keep the others.

Example:
- Existing array [1, 2, 2, 3, 2, 3]
- I want to remove the very first user 2
- Desired result [1, 2, 3, 2, 3] โ†’ the first user 2 removed, the other users nr. 2 kept

Standard Remove function always deletes all results with nr. 2 (I also tried to use the filter First but didn't help)

Thanks a lot!

Lukas

13 replies