Building string array of unique values

Bronze Contributor
Bronze Contributor

Hello all,

 
When on a product detail page, I need to capture the product id, product name, and product price and store in an attribute (or collection of attributes) for every product viewed during a visit.
 
I'm struggling to figure out how to handle duplicates.  When using a collection of attributes, sets of strings follow alphabetic order which will make the product ids, names, and prices out of alignment, however I don't have to worry about duplicates.
 
Thanks,
John Hermes
 
 
Thanks,
John Hermes
2 REPLIES 2

Building string array of unique values

Gold Contributor
Gold Contributor

Hi @jhermes ,

Just this is a point from my side. Other's may have better solution. 

To store the values in pushed order, we can use array of string attributes and to manage duplicates we can use enrichment rules.

I Just tried roughly in my account, attaching screenshots here

1) Enrichment Rules

Enrichment Rules.JPG

2) Enriched Attribute in Trace

Array of Strings.JPG

Thanks,

VJ

Its Not Who I am Underneath, but What I Do That Defines Me

Building string array of unique values

Bronze Contributor
Bronze Contributor

Hello @dragooon ,

Thank you so much for helping out with this.  This logic works for what I am trying to do.

The "or" part is what I was missing.  I didn't think about the attribute not being assigned / initialized.

Thank you,

John Hermes

Thanks,
John Hermes
Public