3 messages in com.googlegroups.google-base-data-apiRe: Having two fields in the order by...| Subject: | Re: Having two fields in the order by clause![]() |
|---|---|
| From: | Jeff S (j....@google.com) |
| Date: | 06/11/2007 11:02:10 AM |
| List: | com.googlegroups.google-base-data-api |
Hello again Ken,
Our team found an example showing how to sort the results by two numeric parameters. In this case you can multiply the numbers to give more weight to your primary parameter which will effectively order by the first attribute, then the second for duplicates. See http://code.google.com/apis/base/ranking-lang-spec.html#resolving for the example. I hope this helps.
Regards,
Jeff
On May 29, 10:48 am, Jeff S <j....@google.com> wrote:
Hi Ken,
It's not possible to send two orderby parameters at this point in
time. However, you can work around this limitation if you use query
restrictions on the range of values, here's an example of sorting
using the expression
language:http://code.google.com/apis/base/ranking-lang-spec.html#sorting
.
Here's the URL for the example above, I've ordered by the number of
bedrooms in a
house:http://www.google.com/base/feeds/snippets?max-results=10&orderby=%5Bx...
(In non URL encoded for that's orderby=[x = bedrooms(int): if
exists(x) then max(x) else fail()] It is possible to place multiple
variables in an orderby expression, and I've also looked into using
the crowdby parameter to do the kind of sorting you are looking for.
One of these options should provide a solution, but the queries are
starting to become a bit complicated :) Let me know if you'd like a
hand.
Happy coding,
Jeff
On May 9, 8:40 am, Ken <kdha...@gmail.com> wrote:
Hi, I am attempting toorderby two fields, price(float+USD) and year(int) via the snippet feed. I can easily sort by one field with &orderby=year(int) or &orderby=price(float+USD), I could not determine how toorderby two fields, i.e. by price, then by year. Can anybody help me out with the syntax or point me in the right direction. I looked thru the forum and the documentation and could not figure it out. Thanks! Ken Hamric




