AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

how can i change the query service results displaying sequence?

Hi,

I have used the query service and successfully get the results shown in my app.

But all results are shown from oldest date to latest date. I want to put the latest result in the top of the list. How can I make it happen?

Please help.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

how can i change the query service results displaying sequence?

Hi AC -

Add sort parameter to the service and by default place "-createdAt" value(without "" of course).

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

how can i change the query service results displaying sequence?

Add the sort parameter to the Request Parameter of the service.

Like this

Image

And to sort in descending order, specify the col name with “-” before it

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

how can i change the query service results displaying sequence?

Hi MM, thx for the helping. After setting in the request section. Should I also map something new in the response section. I post a snapshot below, please help

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

how can i change the query service results displaying sequence?

Image

after adding this and map it, I can get first three pictures from latest date to oldest date, but rest of picture still keep same sorting way...do i map something wrong ?

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

how can i change the query service results displaying sequence?

the second step- put "-" in front of col name. Do u mean sort the col in the database? Or I need to make some setting in the response mapping?

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

how can i change the query service results displaying sequence?

Nope you don't have to do any additional mapping for sorting. Just need to add "sort" parameter and on the right side add the column name, in your case createdAt. In case you want to sort in descending order then use -createdAt

AC
Posts: 0
Joined: Wed Oct 08, 2014 8:53 pm

how can i change the query service results displaying sequence?

Made it happen! Thx a lot MM!

Return to “Issues”