How to Sort a Power Apps Dropdown Control?

In this Power Apps Tutorial, we will see how to sort a dropdown control in Power Apps.

We recently received a request from one of our clients. While working with the Power Apps canvas app, they want to sort the items inside the dropdown control.

In detail we will discuss here:

  • Sort a dropdown control in a Power Apps edit form
  • Sort a dropdown control in a Power Apps gallery
  • Sort Power Apps dropdown control alphabetically

Let’s see how to sort the items in ascending or descending order in a Power Apps dropdown control.

Sort a Power Apps dropdown control

In this section, we’ll look at various methods for sorting a Power Apps dropdown control. In addition, we will use various formulas to sort the dropdown items in the Power Apps edit form and gallery control.

Sort a dropdown control in a Power Apps edit form

In this section, we will see how to sort a dropdown control within a Power Apps edit form. As a result, it will let the user find their items in a descending or ascending order.

  • There is a SharePoint list based on Project Management having different types of columns such as single line text column, date & time column, people column, etc. Also, the list has a choice column named ‘Project Location’.
Power Apps sort dropdown control
Power Apps sort dropdown control
  • Let’s build an edit form inside the Power Apps canvas app. Connect that edit form with the SharePoint list. On the Power Apps canvas app screen, go to Insert > Edit form > Select.
  • Connect the Power Apps edit form to the above SharePoint list as a data source.
  • Automatically the form will appear with all the respective control as shown below:
How to sort Power Apps dropdown control
How to sort Power Apps dropdown control
  • let’s remove the combo box control from the Project Location and add a Power Apps Dropdown control.
  • To display the choices from the Project Location SharePoint column insert the below expression on the dropdown’s Items property.
Items = Choices([@'Projects Management'].'Project Location')
Sorting PowerApps dropdown control
Sorting PowerApps dropdown control
  • On the above dropdown, the items are not sorted. To sort the above dropdown items, insert the below expression on the Power Apps dropdown’s Items property.
Items = Sort(
    Choices([@'Projects Management'].'Project Location'),
    Value
)
Sorting PowerApps dropdown control in ascending order
Sorting PowerApps dropdown control in ascending order

Also, you can use the below expression to sort a Power Apps dropdown control within the edit form.

Items = Sort(
    Choices([@'Projects Management'].'Project Location'),
    ThisRecord.Value,Descending
)

Once the formula is applied, we can see all the items are sorted in descending order as shown below:

Sort dropdown control in Power Apps
Sort dropdown control in Power Apps

This is how to sort Power Apps dropdown choices in ascending order.

Sort a dropdown control in a Power Apps gallery

Similarly, here we will see how to sort a dropdown control in a Power Apps gallery.

Here, we have prepared a Power Apps vertical gallery using the above SharePoint list named ‘Project Management’.

  • On that gallery, add a dropdown control to let the user select the Project Location. For this, insert the below expression in the dropdown’s Items property to display the choices.
Items = Choices('Projects Management'.'Project Location')
Sorting a PowerApps dropdown control
Sorting a PowerApps dropdown control
  • To sort the above Power Apps dropdown control, insert the below expression on the dropdown’s Items property.
Items = SortByColumns(
    Choices('Projects Management'.'Project Location'),
    "Value",
)
Sort Power Apps dropdown control
Sort Power Apps dropdown control

This is how to sort a Power Apps dropdown control within the gallery.

Sort Power Apps dropdown control alphabetically

In this section, we will see how to sort a Power Apps dropdown control alphabetically. Let’s build a Power Apps dropdown control using the project name and sort them alphabetically.

  • Add a dropdown control to the Power Apps screen.
  • Insert the below expression on the Items property of the dropdown control to display the projects’ names.
Items = 'Projects Management'.'Project Name'
Sort Power Apps dropdown control alphabetically
Sort Power Apps dropdown control alphabetically
  • To sort the above dropdown alphabetically (descending or ascending), insert the above expression on the dropdown’s Items property.
Items = Sort(
    'Projects Management',
    'Project Name',
    SortOrder.Descending
)
How to sort Power Apps dropdown control alphabetically
How to sort Power Apps dropdown control alphabetically

This is how to sort a Power Apps dropdown control alphabetically.

Conclusion

From this Power Apps tutorial, we learned how to sort a PowerApps dropdown control based on different scenarios such as:

  • Sort a dropdown control in a Power Apps edit form
  • Sort a dropdown control in a Power Apps gallery
  • Sort Power Apps dropdown control alphabetically

You may also like:

>