cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msmartin0014
Level: Power Up

Sorting by a dropdown

I am creating a referral tracking app that includes a dropdown list where the user can select the 'Priority' of their entry (high, medium, low). I would like to create a filter or sort option in the gallery so that users can sort based on the Priority of their entry. I am not sure how to achieve this while keeping the SortByColumn Title feature. 

 

What would the funtion be to create a filter/sort button?

Thank you!

PowerApps.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Sorting by a dropdown

Hi @msmartin0014 

 

To achieve this, you can create a dropdown with Items -> ["High","Medium","Low"]
 
While filtering the data in gallery, you can use the expression:
Sort(Filter(DataSourceName, ColumnName = Dropdown1.Selected.Value), "Title", If(SortDescending,Descending,Ascending))

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
Dual Super User
Dual Super User

Re: Sorting by a dropdown

Hi @msmartin0014 

 

an example

SortByColumns(
  Filter(datasource, 
 condition
  ), 
  "columnname", 
  If(SortDescending1,Descending,Ascending)
)

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Dual Super User
Dual Super User

Re: Sorting by a dropdown

Hi @msmartin0014 

 

To achieve this, you can create a dropdown with Items -> ["High","Medium","Low"]
 
While filtering the data in gallery, you can use the expression:
Sort(Filter(DataSourceName, ColumnName = Dropdown1.Selected.Value), "Title", If(SortDescending,Descending,Ascending))

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Community Support Team
Community Support Team

Re: Sorting by a dropdown

Hi @msmartin0014 ,

Could you please share a bit more about the data source you used in your app? Is it a SP list?

Do you want to sort or filter your Gallery items based on the Priority of the entry?

Which column do you used to store the Priority value? Choice type column or Single Text type column?

 

If you want to Filter or Sort your Gallery Items based on the selected Priority value wihtin the Dropdown box, please take a try with the following workaround:

Add a Dropdown control, set the Items property to following:

["high", "Medium", "Low"]

1. You use Choice type column to store the Priority value:

Set the Items property of the Gallery to following:

SortByColumns(
AddColumns(
Filter(
'YourSPList',
StartsWith(Title, TextSearchBox1.Text),
ChoiceColumn.Value = Dropdown1.Selected.Value /* <-- ChoiceColumn represents the Choice type column in your SP list */
),
"ChoiceValue",
ChoiceColumn.Value
)
"Title", If(SortDescending1, Descending, Ascending),
"ChoiceValue", If(SortDescending1, Descending, Ascending)
)

2. If you use Single Text column to store the Priority value:

Set the Items property of the Gallery to following:

SortByColumns(
Filter(
'YourSPList',
StartsWith(Title, TextSearchBox1.Text),
PriorityColumn = Dropdown1.Selected.Value /* <-- PriorityColumn represents the Text type column in SP List */
),
"Title", If(SortDescending1, Descending, Ascending),
"PriorityColumn", If(SortDescending1, Descending, Ascending)
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,618)