Forum Discussion
Hi CJ, your solution has been really helpful to me. Thank you so much. I have an add-on question about this solution though. As it’s building the new array using the reduce statement you passed on to me, how can I insure that I’m not putting duplicate values into it? Hoping you can help.
Thanks, Alex
glad it was helpful.
You can use a map to store your values instead of an array and store the values as your keys. Maps do not allow for duplicate key entries, which would take care of this problem for you, and you could collect your ‘values array’ by using keys() method described here:
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1439367/Object+Functions+and+Properties#ObjectFunctionsandProperties-keys
This is just one solution, there are many ways you can keep track of this if needed.