David Andrews
Posts: 0
Joined: Mon Mar 11, 2013 10:04 pm

Sorting database results from a service

I am having trouble figuring out how to add a sort parameter to a database service using the services in Tiggzi. I have tried adding a new parameter with this

Parameter Name (-G --data-urlencode)
Default Value ('sort=number')

I get the results but they are not sorted by the column "number"
I'm guessing I'm doing it all wrong. Any help would be appreciated.

David Andrews
Posts: 0
Joined: Mon Mar 11, 2013 10:04 pm

Sorting database results from a service

That's where I got the information I used for the above method. It doesn't really help me understand how to use those parameters using your fill in the blanks "service builder" to accomplish the same task.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Sorting database results from a service

Hi David,

To sort data received from database you would need to add Request parameter "sort" that has a collection column name as a value (case sensitive).

If you access database via CURL you should use the following argument:

--data-urlencode "sort=number"

David Andrews
Posts: 0
Joined: Mon Mar 11, 2013 10:04 pm

Sorting database results from a service

Ok, Thanks! I see now and I got it to work.

RobertJay
Posts: 0
Joined: Fri Jun 15, 2012 1:32 pm

Sorting database results from a service

Hi Katya, my collection has numbers but in string format. Is there any way of forcing a numeric sort with such columns ... or will I have to re-import the database with those columns as numbers? Thanks.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Sorting database results from a service

Hello Robert,

if you want sort you field as number you shoud have type of this field as "number".

Oliver Fisk
Posts: 0
Joined: Wed Jul 09, 2014 10:02 pm

Sorting database results from a service

How can I sort alphabetically on text fields?
How can I sort dates?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Sorting database results from a service

Hi Oliver,

You can use parameter "sort": http://devcenter.appery.io/documentat...

Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

Sorting database results from a service

Hi Katya,

In my data base I have like 20 records,

When I do a list service of those records, the order shown is not the same as in the data base. For example, If I add a new record in the DB, when I test the app, that new record appears in 14th place. I know that I can add a new column and then do a query using "sort", but in the meantime, what can I do so the new added record is the first shown in preview?

Regards

Return to “Issues”