Hi There.
I am having a issue with a where clause that was working yesterday, but seems to be returning errors today.
$today = new Date();
$yesterday = new Date($today);
$yesterday.setDate($today.getDate() - 1);
var PAGESIZE = 80;
var dataQuery = new Backendless.DataQuery();
dataQuery.condition = "created =>" + $yesterday;
dataQuery.options = {
pageSize: PAGESIZE
};
$scope.frombackend = Backendless.Persistence.of(Sighting).find(dataQuery).data;
Using that would normally work but now it is returning the following error ( Summarized)
400 (Bad Request)
Invalid where clause at position 9: no viable alternative at input 'created=>'
My App ID ; CB6B8616-2326-5840-FF5A-D2CCCB36F300
The Table in question is the sightings table, normal object retrieval works fine as far as I can see. The aim is to only get objects created in the last 24 hours or so.
This is quite novel feature , id really like to get it working again.
Kind Regards Andrew
I can see your date format is different to mine. Mine comes out as Thu Dec 15 2016 13:19:58 GMT+0200 (SAST) for instance. Would that play a role?
Even with new objects available in the database, the above code still throws a error, is there a specific format required for these kind of queries? Has there been a recent update that I have perhaps missed?
Using the rest client I can pull normal data objects from any table using javascript with no issue, however using the exact angular example I posted above I was able to , until very recently pull data objects according to their created by date.
I havent been able to get it working since then. I instead wrote a simple function to compare dates, although it is longer than the elegant SQLesque solution that backendless does provide.
When you get an error saying the where clause is invalid, there must be something in it that breaks the processing on the server side. To best way to diagnose those errors is to use the built-in REST Console. See the following article describing how to use it: https://backendless.com/feature-77-using-backendless-rest-console-to-fetch-your-data/
Nothing was changed in terms of the data or the query. It just stopped working. But regardless it is fine, I have written my own date compare and I can still fetch objects fine without the clause.