Do you know how to sort Power Apps Dropdown choices alphabetically (ascending/descending order)? Ok, No worries!!
This Power Apps tutorial explains how to sort Dropdown choices alphabetically in Power Apps. Also, by using various scenarios, we will see how to sort the Power Apps Dropdown with SharePoint Text and Choice fields.
How to Sort Dropdown Choices Alphabetically in Power Apps
In this topic, we will see how to sort the dropdown choice values alphabetically in Power Apps. Follow the below scenarios.
- I have a SharePoint list called TSInfo Attachments having the fields below:
Column | Datatype |
---|---|
ID | Number |
Title | Single line of text |
Attachment Types | Choice [PPT, PDF, Excel, Microsoft Document] |
Attachment Costs | Currency |
Attachment Created Date | Date and time |
Also, this list has some records, as shown below:
For the below scenarios, I have used the above SharePoint list.
Scenario – 1: (Power Apps Sort Dropdown with Single line of text field)
1. In Power Apps, there is a Dropdown control. I want to arrange the SharePoint Title values in the dropdown menu in descending order.
2. To work around this, select the Dropdown menu and set its Items property as:
Items = Sort(
'TSInfo Attachments',
Title,
SortOrder.Descending
).Title
OR
Items = Sort(
Distinct(
'TSInfo Attachments',
Title
),
Value,
SortOrder.Descending
)
Where,
Descending = Specify the order to arrange the dropdown values
3. Save, Publish, and Preview the app, then the dropdown control will display all the sort results.
Scenario – 2: (Power Apps Sort Dropdown with Choice field)
Next, we will see how to sort the Power Apps Dropdown control alphabetically with the SharePoint Choice column.
1. In the above SharePoint list, there is a Choice column called Attachment Types. I want to sort these choice values in the Power Apps Dropdown control.
2. To achieve this, select the Dropdown control and set its Items property to the below code:
Items = Sort(
Choices([@'TSInfo Attachments'].'Attachment Types'),
Value
) // By default, the sort will be in ascending order
OR
Items = Sort(
Choices([@'TSInfo Attachments'].'Attachment Types'),
ThisRecord.Value
) // By default, the sort will be in ascending order
Where,
- ‘TSInfo Attachments‘ = SharePoint List name
- ‘Attachment Types‘ = SharePoint Choice column name
This is how to sort the Power Apps Dropdown control alphabetically with the SharePoint Choice column.
Scenario – 3: (Power Apps Sort Dropdown with Descending Order)
Here, we will see how to sort the Power Apps Dropdown in descending order.
1. The Attachment Types values are sorted in descending order in the below Power Apps Dropdown control.
2. To achieve this, we can apply the code below on Dropdown’s Items property, i.e.
Items = SortByColumns(
Choices([@'TSInfo Attachments'].'Attachment Types'),
"Value",
SortOrder.Descending
)
Where,
- ‘TSInfo Attachments‘ = SharePoint List name
- ‘Attachment Types‘ = SharePoint Choice column name
This is how to work with Power Apps sort dropdown choices.
Conclusion
In this Power Apps tutorial, we discussed how to sort Dropdown choices alphabetically in Power Apps.
We also learned how to sort the Power Apps Dropdown with SharePoint Text and Choice fields using several scenarios.
Moreover, you may like some more Power Apps tutorials:
- Sort by Columns in Power Apps
- Sort Power Apps Gallery By ID
- Power Apps Sort Distinct Filter
- Add New Row in Power Apps Gallery Control
- Sort Gallery by Person Column in Power Apps
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com