cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WiggityZwiggity
Helper V
Helper V

Sytnax for Odata Order By

Is it possible to use multiple fields in the order by odata filter on a SharePoint get items action?  i.e. if I want to sort by Title Field, then Date Field as an example:

 

Title asc and Date asc

 

What is the correct way to structure that - it appears to be differen than the filter query sytax.

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @WiggityZwiggity,

 

The workable Sytnax for the order by should be:

Title asc, Date asc

Image reference:

59.PNG

 

The Sytnax usage is described here:

Use OData query operations in SharePoint REST requests

For orderby:

"

Use the $orderby query option to specify how to sort the items in your query return set. To sort by multiple fields, specify a comma-separated list of fields. You can also specify whether to sort the items in ascending or descending order by appending the asc or desc keyword to your query.

"

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @WiggityZwiggity,

 

The workable Sytnax for the order by should be:

Title asc, Date asc

Image reference:

59.PNG

 

The Sytnax usage is described here:

Use OData query operations in SharePoint REST requests

For orderby:

"

Use the $orderby query option to specify how to sort the items in your query return set. To sort by multiple fields, specify a comma-separated list of fields. You can also specify whether to sort the items in ascending or descending order by appending the asc or desc keyword to your query.

"

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

That's awesome.  Is there a way to also apply this sorting on Unions?  i.e. if I am joining 2 arrays, and I want the combined results to sort?  the union(array1,array2) expression doesn't seem to allow for this.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,402)