cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

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

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
Highlighted
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

Highlighted
Dual Super User III
Dual Super User III

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

Highlighted
Community Support
Community Support

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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,557)