I have a JQL query in mixpanel which should return result based on two different events. Here are the steps:
- First event after filtering would return some array of values as result.
- Second event should use that result and return the required values after some filtering.
JQL query as below
function main() {
var date_range = {
from_date: "2017-08-02",
to_date: "2017-08-02"
};
var firstEventResult = Events(date_range).map(function(event) {
return (event.name === "country" && event.properties.sector === "IT") ? event.properties.Area: null;
}).filter(function(v) {
return v;
});
return Events(date_range).map(function(event) {
return (event.name === "state" && firstEventResult.indexOf(event.properties.Area)) ? event.properties.message: null;
}).filter(function(v) {
return v;
});
}
In the above code, firstEventResult.indexOf() is returning error as "indexOf is not a function". But, firstEventResult is returning an array like below
[
"Delhi"
"Punjab"
"Kerala"
]