Question

"Equals" vs "Contains" on where clauses for arrays

  • 14 July 2021
  • 2 replies
  • 33 views

We have an event that has a property that can be one of 4 values, for simplicity, let’s say it can be A, B, C, or D. When looking at the event I want to only see events that have the property value of A or B. I’ve been switching between “equal” and “contains” on the where clause assuming they would have the same result (all of the property values are completely unique, so there should be no overlap with contains), but the contains is returning more results than the equals. 

 

I can’t find anything in the help docs to explain the expected behavior of both. Appreciate any ideas anyone has here. Thanks!


2 replies

Userlevel 5
Badge +4

Hey @Connor ,

If you want to chart out only the events with property value of A or B, then you should be selecting both the values of A and B ( essentially acting as OR ) in the where clause. Both “=” and “contain” should work as long as the event properties are captured as single values. I tried replicating your use case in this demo chart and both ways should ideally give you same results.

Since you mentioned “arrays” in the question title, are those event properties captured in an array or as single values?

 

 

Userlevel 4
Badge +3

Hi Connor,

 

I agree with Saish could you also comment on if your values are in arrays as well. That would make the equal and contains return different values since arrays have more than one value.

 

Best,

Sydney

Reply