Re: [google-appengine] How to filter a Query by Date

2014-02-27 Thread Ben Liet


 As you noted, the datastore only supports one inequality filter. In 
 general, most people get around it by querying on one inequality, 
 collecting all the matching results, and filtering on the other inequality 
 within the application. Another way is to use IN queries: see this example 
 SO answer: 
 http://stackoverflow.com/questions/14939152/gae-datastore-filter-by-date-interval
   


ok, thanks for the reply.
it is very disappointing that theres only this ungly workarounds...  

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


[google-appengine] How to filter a Query by Date

2014-02-26 Thread Ben Liet

Hello,

I have an object with a startdate and a enddate.
Now I would like to select all objects where a parameter is between the 
start- and enddate.
But the datastore supports only one inequality filter per query (excepted 
on one field). So how i could implement a query to get the objects i want?
I use JDO.

*Example*:
*Datastore*:
Object 1: 20.01.2014 - 28.01.2014
Object 2: 17.01.2014 - 22.01.2014 

*Querys*:
Parameter: 21.01.2014
Result: Object 1, Object 2

Parameter: 27.01.2014
Result: Object 1

Parameter: 18.01.2014
Result: Object 2

Parameter: 02.03.2014
Result: Empty

Have a nice day
Benjamin

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] How to filter a Query by Date

2014-02-26 Thread Vinny P
On Fri, Feb 21, 2014 at 6:20 AM, Ben Liet benl...@gmail.com wrote:

 I have an object with a startdate and a enddate.
 Now I would like to select all objects where a parameter is between the
 start- and enddate.
 But the datastore supports only one inequality filter per query (excepted
 on one field). So how i could implement a query to get the objects i want?



As you noted, the datastore only supports one inequality filter. In
general, most people get around it by querying on one inequality,
collecting all the matching results, and filtering on the other inequality
within the application. Another way is to use IN queries: see this example
SO answer:
http://stackoverflow.com/questions/14939152/gae-datastore-filter-by-date-interval



-
-Vinny P
Technology  Media Advisor
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.