Page 1 of 3

Query a date range.

Posted: Tue Jul 22, 2014 1:48 am
by Robert Larsen

I am wanting to build a selectable query for date range. Example Two calenders... First calender you select the from date, and the second calender you select the to date. Then you click search and it returns all items from a collection that was created in between those two dates. Second problem I know you have to specify a where perimeter but how would you achieve this using the calender widget, if at all possible?


Query a date range.

Posted: Tue Jul 22, 2014 8:41 am
by Kateryna Grynko

Hi Robert,

Add the following code to a service parameter 'where':prevar d1 = Apperyio("mobiledatepicker_1").datapickerRoot.find("input").val();
var d2 = Apperyio("mobiledatepicker_2").datapickerRoot.find("input").val();
return jQuery.parseJSON('{"mydate":{"$gte":"'+ d1+'", "$lt":"'+ d2 +'"}}');/preWhere mobiledatepicker_1 and mobiledatepicker_2 are Datepicker names,
mydate is a name of Database date field.

A result of execution is a list of objects where
mobiledatepicker_1 < mobiledatepicker_2.


Query a date range.

Posted: Wed Jul 23, 2014 12:11 am
by Robert Larsen

So would I add two Datepicker widgets and have it set to store the selected date to local storage using the names mobiledatepicker_1 and mobiledatepicker_2? And also could you clarify or explain more of what you mean by the "mydate is a name of Database date field"? DO you mean I would insert the column name for the date field of the collection here? I am not a 100% what you mean by this.


Query a date range.

Posted: Wed Jul 23, 2014 9:01 am
by Kateryna Grynko

Hi Robert,

mobiledatepicker_1 and mobiledatepicker_2 are names of components to chose date:
http://devcenter.appery.io/documentat...

mydate is a name of field in Database that is of a 'date' type:
http://devcenter.appery.io/documentat...


Query a date range.

Posted: Thu Jul 24, 2014 12:48 am
by Robert Larsen

Ok this is not working for me server response is just incorrect query no other details. I added the provided code to the request tab of where under add js. Then I added two mobiledatepicker components to the page and named them accordingly. I then changed "mydate" to RODate in the java field. Set the service to invoke on button click. I even changed the date format of the mobiledatepicker to yyyy-mm-dd. What am I doing wrong here.


Query a date range.

Posted: Thu Jul 24, 2014 7:00 am
by Kateryna Grynko

Hi Robert,

Could you please share the app and tell us how to invoke this service?


Query a date range.

Posted: Thu Jul 31, 2014 1:06 am
by Robert Larsen

The app is shared it's called tech time.


Query a date range.

Posted: Thu Jul 31, 2014 3:32 pm
by Kateryna Grynko

Hi Robert,

In service Test tab, an empty list is returned from Database Time%20Records, too. Please save values there first.

Could you please specify what dates are to choose and how to reproduce the issue?

You use a field "mydate" in where query. Please make sure there is a such field in your collection. We cannot find it in Create service parameters.


Query a date range.

Posted: Mon Oct 13, 2014 9:01 pm
by Mike6979865

Hi, I tried this code provided above to query a date range, but it's not working.


Query a date range.

Posted: Tue Oct 14, 2014 11:50 am
by Kateryna Grynko

Hi Mike,

Could you please clarify whether there is an error in browser console or you receive an empty response?