Control.query or openTableToListView order by column

Quick question - results are ordered by capture order by default. is it
possible to apply order by criteria so you can for example order by
surname, or order by date captured etc

looked through some of the examples but can't see anything that shows this

Thanks
Andrew

As far as I remember, default return order is unspecified. It might be
returning results ordered by capture date, but since that isn't part of the
API it is subject to change. If you require a certain order (be it capture
date or something else), I'd recommend ordering the results yourself.

I believe currently it is recommended to do this in JavaScript. I normally
turn the TableData objects returned by control.query() into an array (using
a for loop). At that point I have all the handy Array methods available,
like sort(), forEach(), etc. If you have vast amounts of data this might
not be a good idea, but for most cases it should be fine.

One of the things being considered with the new API is how much SQL should
be exposed to callers. If you have opinions about what functionality you'd
like to see in the API, let the team know.

··· On Thu, Dec 17, 2015 at 1:02 AM, Andrew de Klerk wrote:

Quick question - results are ordered by capture order by default. is it
possible to apply order by criteria so you can for example order by
surname, or order by date captured etc

looked through some of the examples but can't see anything that shows this

Thanks
Andrew

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

thanks Sam...will look at js based sorting

··· On Thursday, 17 December 2015 17:21:20 UTC+2, Sam Sudar wrote: > > As far as I remember, default return order is unspecified. It might be > returning results ordered by capture date, but since that isn't part of the > API it is subject to change. If you require a certain order (be it capture > date or something else), I'd recommend ordering the results yourself. > > I believe currently it is recommended to do this in JavaScript. I normally > turn the TableData objects returned by control.query() into an array (using > a for loop). At that point I have all the handy Array methods available, > like sort(), forEach(), etc. If you have vast amounts of data this might > not be a good idea, but for most cases it should be fine. > > One of the things being considered with the new API is how much SQL should > be exposed to callers. If you have opinions about what functionality you'd > like to see in the API, let the team know. > > On Thu, Dec 17, 2015 at 1:02 AM, Andrew de Klerk <andrew....@gmail.com > wrote: > >> Quick question - results are ordered by capture order by default. is it >> possible to apply order by criteria so you can for example order by >> surname, or order by date captured etc >> >> looked through some of the examples but can't see anything that shows this >> >> Thanks >> Andrew >> >> -- >> -- >> Post: opend...@googlegroups.com >> Unsubscribe: opendatakit...@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "ODK Community" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to opendatakit...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

This link has some good examples of how to do it:

··· On Thu, Dec 17, 2015 at 12:05 PM, Andrew de Klerk wrote:

thanks Sam...will look at js based sorting

On Thursday, 17 December 2015 17:21:20 UTC+2, Sam Sudar wrote:

As far as I remember, default return order is unspecified. It might be
returning results ordered by capture date, but since that isn't part of the
API it is subject to change. If you require a certain order (be it capture
date or something else), I'd recommend ordering the results yourself.

I believe currently it is recommended to do this in JavaScript. I
normally turn the TableData objects returned by control.query() into an
array (using a for loop). At that point I have all the handy Array methods
available, like sort(), forEach(), etc. If you have vast amounts of data
this might not be a good idea, but for most cases it should be fine.

One of the things being considered with the new API is how much SQL
should be exposed to callers. If you have opinions about what functionality
you'd like to see in the API, let the team know.

On Thu, Dec 17, 2015 at 1:02 AM, Andrew de Klerk andrew....@gmail.com wrote:

Quick question - results are ordered by capture order by default. is it
possible to apply order by criteria so you can for example order by
surname, or order by date captured etc

looked through some of the examples but can't see anything that shows
this

Thanks
Andrew

--

Post: opend...@googlegroups.com
Unsubscribe: opendatakit...@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google
Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to opendatakit...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.