Forum Discussion
alex_panganiban
7 years agoContributor
Thought I’d let you know how I was able to remove duplicate entries from my array. I basically was using this reduce method to create my array in a mapper expression.
$product.reduce((accum, curval) => accum.concat([curval[‘variation-attribute-value’][0]]), )
To remove any duplicate entries while the array was being built, I added a filter method to it, like so:
$product.reduce((accum, curval) => accum.concat([curval[‘variation-attribute-value’][0]]), ).filter((item, pos, a) => a.indexOf(item) == pos)
I pretty much just copy/pasted this filter method from the Snaplogic help documentation.
Thanks everyone for your help. I really appreciate all the support.
Related Content
- 3 months ago
- 3 years ago
- 5 years ago