Discussions

Expand all | Collapse all

Crossfilter previous filters are not clearing

  • 1.  Crossfilter previous filters are not clearing

    Posted 07-02-2018 09:57

    Hi, I have below query formation in mapd crossfilter which gives me a sql as below:

    SELECT COUNT(*) as val FROM PLACES WHERE ((latitude >= 19.69089672512304 AND latitude <= 56.78083875041932)) AND ((longitude >= -142.97341062499999 AND longitude <= -4.985129374999985))

    var latitudeArr = [
    [bounds.minLat, bounds.maxLat]
    ];
    var longitudeArr = [
    [bounds.minLon, bounds.maxLon]
    ];

    crossfilter.dimension('latitude').setDrillDownFilter(true).filterAll().filterMulti(latitudeArr, false, false, null).groupAll().getCrossfilter().dimension('longitude').setDrillDownFilter(true).filterAll().filterMulti(longitudeArr, false, false, null).groupAll().reduceCount().writeQuery();

    The issue I am facing is that the latitudeArr and longitudeArr are dynamic in nature but I am seeing previous filters on latitude and longitude going on appending which I do not want in my sql

    SELECT COUNT(*) as val FROM PLACES_VER_111_NO_X WHERE ((latitude >= 19.69089672512304 AND latitude <= 56.78083875041932)) AND ((longitude >= -142.97341062499999 AND longitude <= -4.985129374999985)) AND ((latitude >= 19.69089672512304 AND latitude <= 56.78083875041932)) AND ((longitude >= -142.97341062499999 AND longitude <= -4.985129374999985))

    Can anyone review my above code and suggest me a fix for this issue.



  • 2.  RE: Crossfilter previous filters are not clearing

    Posted 07-03-2018 12:55

    Hi @sachinpkaushik - Thanks for posting. We have a few people off this week because of the July 4th holiday, so apologies for the slow response. I’ve asked around internally to find someone more familiar with crossfilter than me, and I’ll make sure we get you an answer soon.



  • 3.  RE: Crossfilter previous filters are not clearing

    Posted 07-10-2018 03:08

    Hi Aaron,

    Any updates on my query?



  • 4.  RE: Crossfilter previous filters are not clearing

    Posted 07-12-2018 14:56

    We have someone taking a look. Should get back to this thread tomorrow latest. Thanks for your patience, @sachinpkaushik!



  • 5.  RE: Crossfilter previous filters are not clearing

    Posted 07-13-2018 14:49

    Hi @sachinpkaushik! Question: Are you re-using the same crossfilter instance to build each query? Crossfilter is stateful, so if you are then that would probably cause the behavior you are seeing.

    If this doesn’t solve your problem, could you please post a full code example that reproduces the unexpected behavior?



  • 6.  RE: Crossfilter previous filters are not clearing

    Posted 07-13-2018 15:31

    Hi Jonathan the code that I have put in my query is the exact code that I use to create Sql.

    Our intention is to reduce the number of calls made to the Mapd server.

    For create new crossfilter instance every time u have to pass connection object and that causes server calls. What I am trying to achieve is reusability of the same crossfilter object as a service to create same sql again and again without having previous filters or where conditions. I hope I am clear with my query or can we connect?



  • 7.  RE: Crossfilter previous filters are not clearing

    Posted 07-13-2018 18:13

    @sachinpkaushik Still not sure exactly how you are passing the connection object. One option here (though without as much reuse) would be to just generate the SQL string from crossfilter and send that as the server query.

    Another to clear all of the global filters at least would be to do this:

    crossfilter.setGlobalFilter([])


  • 8.  RE: Crossfilter previous filters are not clearing

    Posted 07-19-2018 18:00

    Hey @sachinpkaushik, just checking to see if this cleared up your issue? I’d be curious to hear more about your use case if you want to share. I’m always looking to hear more about how people are using the cross-filter API.

    Thanks!



  • 9.  RE: Crossfilter previous filters are not clearing

    Posted 07-20-2018 01:12

    Hi Aaron it will help if we may connect online on skype so that I can explain the issue that I am facing with an example.