Paging - ordered by a signed integer

4 views
Skip to first unread message

HC

unread,
Nov 23, 2009, 3:03:44 AM11/23/09
to Google App Engine, h...@vst.io
Hi,

I've read the GAE article on paging http://code.google.com/appengine/articles/paging.html
and have a working solution but I cannot help feeling that it
unnecessarily complex.

I want to page through a dataset, ordered by a signed integer value
(votes).

What I first tried was to store votes in an integer property and the
timestamp (my paging index) in a string property, but when trying to
oder by votes and filter by timestamp I am told that I cannot use an
inequality filter on one field when ordering on another field
beforehand (or something to that effect - I don't have the error
message, sorry).

Now, I am storing votes in a string property as "hex(votes)|
timestamp", where hex does some extra work for negative numbers

So, 10 is stored as 0000000A|20091123... such that alphabetic ordering
works.

This is awkward. How do you page through integers?

Thanks for any help,
HC




Meg Smitley

unread,
Dec 30, 2009, 6:21:54 AM12/30/09
to Google App Engine
Hi HC,

I encountered a similar problem. Your hex solution worked for me and
seems to sit nicely within the Gregorio reference implementation. If
you've come across anything better, I'd be interested to know. I
blogged my experiences paginating which might be of interest:
http://megsmitley.blogspot.com/2009/12/google-app-engine-paging-with.html

Best and thanks for your help,
Meg

On Nov 23, 8:03 am, HC <hc...@gmx.net> wrote:
> Hi,
>

> I've read the GAE article onpaginghttp://code.google.com/appengine/articles/paging.html


> and have a working solution but I cannot help feeling that it
> unnecessarily complex.
>
> I want to page through a dataset, ordered by a signed integer value
> (votes).
>
> What I first tried was to store votes in an integer property and the

> timestamp (mypagingindex) in a string property, but when trying to

Reply all
Reply to author
Forward
0 new messages