How do I simplify a list containing duplicate text items, to a new list containing only the unique values?
1 Answers
Answer by Carolyn Wilson ✅ (Accepted)
Add a “new Set Expression”, such as:
| […new Set(‘a | b | c | a | b | c’.split(’ | ’))].join(”, “) |
| If the string were ‘a | b | c | a | b | c’, splitting it with | would give you ‘a, b, c’ |
| Note: Each value in the original list is separated buy a ‘ | ’ character. |
| Example: […new Set(‘<<[ForEach:Fund[ | ]:<<FundName>>]>>‘.split(’ | ’))].join(”, “) |
The expression starts with a string, splits it into parts based on |, removes duplicates, and then joins those parts back together into a single string, separated by commas.