Solved

Properly parse a list of values

  • 16 December 2021
  • 1 reply
  • 59 views

Badge
values are sent as a list

 

Hi! I’m passing a list of values for an event property. Is there a “correct” way to parse these strings and analyze them individually rather than as a list?

 

For example [“backpacking”, “camping”] => two entries, one for backpacking & one for camping.

 

Thanks,

 

Matt

icon

Best answer by Saish Redkar 17 December 2021, 12:26

View original

1 reply

Userlevel 7
Badge +4

Hey @matt 

Afaik, properties sent as array lists can be analyzed in two ways

  • as an individual value belonging to the array
  • as a set

If you use contains/is, then Amplitude looks for the substring/exact match in the array and matches it.

So contains/is “camping” will match events with both [“backpacking”, “camping”] and [“camping”] as event properties. Here’s a demo chart.

If you want to evaluate the array as a set, then the set operators helps. You can read more here on how they work.

Let me know if I have interpreted your use case correctly.

 

 

Reply