Solved

JQL bracket notation

  • 25 February 2019
  • 1 reply
  • 60 views

Badge

Having a bit of difficulty in JQL. At one stage of one of our queries we want to group by a couple of different properties, which have been found by joining events and people. These are the qualities we are trying to join by.

      "user.properties.$initial_referring_domain",
     "user.properties['Landing Page Source']",
     'event.properties.utm_source'

The issue is that one of the variables has spaces in the name of it, meaning the dot notation to call that property does not work, however even when using the bracket notation, it just comes back with the second value as null, despite the variable not being null.

i.e. results in the form;

  {
    "key": [
      "$direct",
      null,
      "blog"
    ],
    "value": 1
  },

My question is, does the bracket notation work in JQL, and if not, does anyone have any other ideas for how I could call this variable?


Many thanks,


Ben

--


icon

Best answer by michael 27 March 2019, 22:09

Hi @benpeddie,

Bracket notation does work in JQL, and normally your notation as shown would be totally right if it were being used in a selector or a filter.

user.properties['Landing Page Source']

However, even though this property is multiple words with spaces in between, since this criteria is already in quotes as part of a groupBy key, you don't need to use bracket notation.

As such, your groupBy keys would look as follows:

  .groupBy(
    [
      "user.properties.$initial_referring_domain",
      "user.properties.Landing Page Source",
      'event.properties.utm_source'
    ],
    mixpanel.reducer.count()
    )

Does that get you the results you need?


View original

1 reply

Userlevel 4
Badge +2

Hi @benpeddie,

Bracket notation does work in JQL, and normally your notation as shown would be totally right if it were being used in a selector or a filter.

user.properties['Landing Page Source']

However, even though this property is multiple words with spaces in between, since this criteria is already in quotes as part of a groupBy key, you don't need to use bracket notation.

As such, your groupBy keys would look as follows:

  .groupBy(
    [
      "user.properties.$initial_referring_domain",
      "user.properties.Landing Page Source",
      'event.properties.utm_source'
    ],
    mixpanel.reducer.count()
    )

Does that get you the results you need?


Reply