cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dkrish2020
Helper I
Helper I

How to sort gallery items with optionset and two optionset fields

Hello,

 

I want to sort gallery items directly without any button click for this iam trying to sort gallery items with optionset field and two optionset and date field. please suggest how to achieve this.

SortByColumns(Notes,"new_category", Descending,"new_bookmarked", Descending,"modified",Descending)

 

iam getting error as cannot sort on expression type on new_category field which is optionset field. please suggest.

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @dkrish2020,


For the optionset you could use an addcolumns function and retrieve the value of the field. You can use the custom column for the sorting.

 

Below is an example of that approach.

In this example Status is the optionset, Checked is the boolean, Modified is still Modified.

 

SortByColumns(AddColumns(PowerApps, "ColumnStatus", Status.Value),"ColumnStatus", Ascending, "Checked", Descending, "Modified", Ascending)

 

 addcolumns_powerapps.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @dkrish2020,


For the optionset you could use an addcolumns function and retrieve the value of the field. You can use the custom column for the sorting.

 

Below is an example of that approach.

In this example Status is the optionset, Checked is the boolean, Modified is still Modified.

 

SortByColumns(AddColumns(PowerApps, "ColumnStatus", Status.Value),"ColumnStatus", Ascending, "Checked", Descending, "Modified", Ascending)

 

 addcolumns_powerapps.png



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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