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

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

View solution in original post

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 (3,365)