Solved

How to write this JQL query to return all the events from the same type.


Userlevel 3
Badge

I'm new to JQL and I'm having a hard time running this JQL query.


Objective: How to write this JQL query to return all the events from the same type.


function main() {
    Events({
      from_date: '2018-01-01',
      to_date:   '2018-05-03',
      name: 'Explored timeline'
    })
}


Error message returned when I run the query:


[Validate failed]Uncaught exception Error: Keys for Events() may only be "event_selectors",
"from_date", "sample_users", or "to_date". Not "name"    

Events({^ Stack trace: Error: Keys for Events() may only be "event_selectors", "from_date", "sample_users", or "to_date". Not "name" at main (<anonymous>:2:5)



icon

Best answer by tim 25 May 2019, 00:26

Hi Fares - check out the event_selectors param here: https://developer.mixpanel.com/docs/jql-api-reference#section-querying-events

The example from the docs is:

function main() {
// Get all signups and purchases by users with email addresses
// from Yahoo or Gmail between January 1st and January 2nd
return Events({
from_date: '2016-01-01',
to_date: '2016-01-02',
event_selectors: [
{event: 'signup', label: 'Signup'},
{event: 'purchase', selector: '"yahoo" in properties["$email"]',
label: 'Purchase (Yahoo)'},
{event: 'purchase', selector: '"gmail" in properties["$email"]',
label: 'Purchase (Gmail)'}
]
})
}

View original

2 replies

Badge

Hi Fares - check out the event_selectors param here: https://developer.mixpanel.com/docs/jql-api-reference#section-querying-events

The example from the docs is:

function main() {
// Get all signups and purchases by users with email addresses
// from Yahoo or Gmail between January 1st and January 2nd
return Events({
from_date: '2016-01-01',
to_date: '2016-01-02',
event_selectors: [
{event: 'signup', label: 'Signup'},
{event: 'purchase', selector: '"yahoo" in properties["$email"]',
label: 'Purchase (Yahoo)'},
{event: 'purchase', selector: '"gmail" in properties["$email"]',
label: 'Purchase (Gmail)'}
]
})
}

Userlevel 3
Badge

This worked:


function main() {

return Events({

from_date: '2019-09-30',

to_date: '2019-05-22',

event_selectors: [

{event: 'Explored Timeline'}

]

})

}



Reply