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
Dual Super User
Dual 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
Dual Super User
Dual 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

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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