ORDER BY making items not available?

0 views
Skip to first unread message

jeremyosborne

unread,
Nov 13, 2009, 12:17:46 AM11/13/09
to NextDB Users
I wish I could narrow this down further for you guys, but this is the
best I can do at the moment.

I had started using ORDER BY in some of my NextQueries but noticed
something odd. Here's an example:

When I run the following query I get only 7 of my english objects
back:

/*******************************************************
*** Get all phrases in a particular language.
*** Return the entire phrase structure.
********************************************************/
NAME=get_phrases_by_language;
ROW phrases FROM PHRASES;
WHERE(TEXT language){
phrases.language = ${language}
}
ORDER BY phrases.phrase ASCENDING;

When I remove the ORDER by statement, I get all 12 english objects
back:

/*******************************************************
*** Get all phrases in a particular language.
*** Return the entire phrase structure.
********************************************************/
NAME=get_phrases_by_language;
ROW phrases FROM PHRASES;
WHERE(TEXT language){
phrases.language = ${language}
}


DESCENDING gives me one less (6) than ASCENDING does. Is there a trick
to using ORDER BY that I need to be aware of?

I think you guys know how to get into my data. Have at it, there is
absolutely nothing other than test data there right now.

Brent Hamby

unread,
Nov 13, 2009, 3:18:29 AM11/13/09
to nextd...@googlegroups.com
Are you setting the start after value?

query.setStartAfterValue();

Thanks,

Brent
--
Brent Hamby
brent...@gmail.com
mobile: 510.421.5232
---The content of this email is confidential.---

Geoffrey Hendrey

unread,
Nov 13, 2009, 9:56:53 AM11/13/09
to nextd...@googlegroups.com, nextd...@googlegroups.com
Jeremy you might also want to use rest for this. Just use jquery Ajax to grab the data. It's insanely easy to do ordering and paging with the rest urls.

I don't think I documented this in the wiki but you can easy verify it by looking at the sorting link at the top of every column in the rest table. I think the syntax is http://nextdb.net/nextdb/JeremyAccount/jeremydb/phrases/language/en/ascending/phrase

Sent from my iPhone

Geoffrey Hendrey

unread,
Nov 13, 2009, 9:59:42 AM11/13/09
to Geoffrey Hendrey, nextd...@googlegroups.com
Whoops o forgot to put "rest"  in the URL

jeremyosborne

unread,
Nov 13, 2009, 12:17:04 PM11/13/09
to NextDB Users
In answer to Brent re: query.setStartAfterValue():

I notice this in raw admin tool queries, too. Does the total number of
possible results change when ORDER BY is used?

In response to Geoff:

I really like the REST API, but for various reasons, in particular
library size, I coded jQuery out of my flashcard widget. I like
platforms, but when my necessary code is around 30k vs. 90k (90k == my
code + jQuery that was hardly used) I really don't want to resort to
jQuery.

I like the JS API a lot because it gives me access to raw JSON that I
don't have to transform. I might have missed it, but can the REST API
provide raw JSON back?

- Jeremy

On Nov 13, 6:59 am, Geoffrey Hendrey <geoff.hend...@gmail.com> wrote:
> Whoops o forgot to put "rest"  in the URL
>
> >http://nextdb.net/nextdb/rest/JeremyAccount/jeremydb/phrases/language...
>
> Sent from my iPhone
>
> On Nov 13, 2009, at 6:56 AM, Geoffrey Hendrey  
>
> <geoff.hend...@gmail.com> wrote:
> > Jeremy you might also want to use rest for this. Just use jquery  
> > Ajax to grab the data. It's insanely easy to do ordering and paging  
> > with the rest urls.
>
> > I don't think I documented this in the wiki but you can easy verify  
> > it by looking at the sorting link at the top of every column in the  
> > rest table. I think the syntax ishttp://nextdb.net/nextdb/JeremyAccount/jeremydb/phrases/language/en/a...
>
> > Sent from my iPhone
>
> > On Nov 13, 2009, at 12:18 AM, Brent Hamby <brentha...@gmail.com>  
> > wrote:
>
> >> Are you setting the start after value?
>
> >> query.setStartAfterValue();
>
> >> Thanks,
>
> >> Brent
>
> >> On Thu, Nov 12, 2009 at 9:17 PM, jeremyosborne <jeremywosbo...@gmail.com
> >> brentha...@gmail.com

jeremyosborne

unread,
Nov 13, 2009, 12:19:37 PM11/13/09
to NextDB Users
In reply to myself about library size:

I wasn't taking the NextDB js api into the equation for now, as it
gives me necessary tools that I like to use. I understand that this
library adds overhead, too, but I load it dynamically after the
initial page loads.

Geoffrey Hendrey

unread,
Nov 13, 2009, 1:15:14 PM11/13/09
to nextd...@googlegroups.com, NextDB Users
I can provide an xslt to generate json. I can also make native json
support in the REST. But one question: don't you ultimately need to
make HTML to present to the user? The jquery selector API works just
great at yanking data out of HTML and sprinkling it into your Dom.

-geoff

Sent from my iPhone

On Nov 13, 2009, at 9:17 AM, jeremyosborne <jeremyw...@gmail.com>
wrote:

Geoffrey Hendrey

unread,
Nov 13, 2009, 1:19:31 PM11/13/09
to nextd...@googlegroups.com, NextDB Users
You should try making an xslt for your app. It runs on the server. You
can't get any smaller than zero kb!

Personally I'll never go back to using js to generate the page HTML
unless I absolutely have to. The xslt is just too easy and no browser
compatibilty issues.

Sent from my iPhone

On Nov 13, 2009, at 9:19 AM, jeremyosborne <jeremyw...@gmail.com>
wrote:

jeremyosborne

unread,
Nov 14, 2009, 3:51:14 PM11/14/09
to NextDB Users
That is a good point, I will probably try that in the future.

But at the moment, I have quite a bit invested in the JS side. It can
be a damn hostile programming language, but it does give me exact
control when and where I need it in the browser.

As an aside about JS in general, I'm not sure it's going to get much
prettier for a few years down the road, I believe you guys are on the
right track with the JSAPI. JS, like most other young programming
languages, will get cleaned up and probably will become the defacto
Web programming language mainly because it's open. I'm learning PHP
right now in my gig. Not very hard. But I gotta say, needing another
layer (like PHP, or even XLST) to provide database queries pales when
I use the NextQuery and JS API you guys came up with.

- Jeremy

On Nov 13, 10:19 am, Geoffrey Hendrey <geoff.hend...@gmail.com> wrote:
> You should try making an xslt for your app. It runs on the server. You  
> can't get any smaller than zero kb!
>
> Personally I'll never go back to using js to generate the page HTML  
> unless I absolutely have to. The xslt is just too easy and no browser  
> compatibilty issues.
>
> Sent from my iPhone
>
> On Nov 13, 2009, at 9:19 AM, jeremyosborne <jeremywosbo...@gmail.com>  
Reply all
Reply to author
Forward
0 new messages