Query a date range.

This forum contains topics that were moved from Get Satisfaction
Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Query a date range.

Post by Mike6979865 »

I'm getting an empty response on the Map. The list service works pefectly fine on the map, and I see all the address on the database, but when I use query with a data range, it's not working. Here are some pics below.

Image

Image

Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query a date range.

Post by Yurii Orishchuk »

HI Mike,

Here is solution for you:

  1. Delete link to "where" request parameter.

  2. Click "JS" on "where" request parameter.

  3. Populate JS editor with following code:

    pre

    var d1 = new Date(Apperyio("startDate").datapickerRoot.find("input").val()).toISOString().replace(/T.*/gi, "");

    var d2 = new Date(Apperyio("endDate").datapickerRoot.find("input").val()).toISOString().replace(/T.*/gi, "");

    var whereObject = {$and: [ {"date": {$gt: d1} }, {"date": {$lt: d2} } ] };

    return JSON.stringify(whereObject);

    /pre

    Details: http://prntscr.com/4wk3w6/direct

    Regards.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Query a date range.

Post by Mike6979865 »

I tried this code:

var d1 = new Date(Apperyio("mobiledatepicker_1").datapickerRoot.find("input").val()).toISOString().replace(/T./gi, "");
var d2 = new Date(Apperyio("mobiledatepicker_2").datapickerRoot.find("input").val()).toISOString().replace(/T.
/gi, "");
var whereObject = {$and: [ {"date": {$gt: d1} }, {"date": {$lt: d2} } ] };
return JSON.stringify(whereObject);

It didn't work.

Regards,

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query a date range.

Post by Yurii Orishchuk »

Hi Mike,

I gave you tested code and it should work.

May be you confuse start and end date?

Please show us "request" in browser debugger network tab where we can see "where" request parameter.

Regards.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Query a date range.

Post by Mike6979865 »

Thanks Yuri, I'll test again.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Query a date range.

Post by Mike6979865 »

I ran the debugger, and the problem is that it querying the date in this format 2014-10-03 , and the dates in the database look like this: 10/03/2014 (i.e MM/DD/YYYY)

Regards,

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Query a date range.

Post by Yurii Orishchuk »

Hi Mike,

Please give us your app public link and describe steps to reproduce this problem.

We will take a look.

Thanks & regards.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

Query a date range.

Post by Mike6979865 »

I'll email you the steps and credentials.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Query a date range.

Post by Illya Stepanov »

Hi Mike,

Could you please resend your mail to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a (with reference to this thread)

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Query a date range.

Post by Kateryna Grynko »

Hi Mike,

Thank you, I will pass this information to our developers.

Post Reply