Add new built-in function to find duplicates
saig0 opened this issue · 4 comments
saig0 commented
Is your feature request related to a problem? Please describe.
Currently, we don't have a direct function that can return us all the duplicates from a list. We managed to use a workaround with the use of list expressions, functions, and control flows. This functionality would be the exact opposite of distinct values().
// repeated_item_list =
for x in list return if count(list[item = x]) > 1 then x else null
// distinct_repeated_list
distinct values(repeated_item_list[item != null])
Describe the solution you'd like
Add a new function to find duplicate values in a list.
Signature:
duplicate values(list: list): list
Examples:
duplicate values([1,2,3,2,1])
// [1, 2]
Related issues
- Camunda Autormation Platform 7:
- Zeebe broker:
- Support: https://jira.camunda.com/browse/SUPPORT-16794
saig0 commented
Workaround
We could use the following expression to find the duplicate values:
distinct values(list[count(index of(list, item)) > 1])
saig0 commented
@aleksander-dytko please prioritize this feature in the context of this support case.
koevskinikola commented
ZPA triage:
- @aleksander-dytko do you have any information on the priority of this issue?
- Is a good candidate for a mob programming session.