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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (61,177)