How to Sort Dropdown Choices Alphabetically in Power Apps?

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:
ColumnDatatype
IDNumber
TitleSingle line of text
Attachment TypesChoice [PPT, PDF, Excel, Microsoft Document]
Attachment CostsCurrency
Attachment Created DateDate and time

Also, this list has some records, as shown below:

PowerApps sort dropdown choices
PowerApps sort dropdown choices

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.

Power Apps sort dropdown choices
Power Apps sort dropdown choices

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

How to Sort Dropdown Choices Alphabetically in Power Apps

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.

See also  How to create and use dataflow in Dataverse

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.

Power Apps sort dropdown choice field
Power Apps sort dropdown choice field

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
PowerApps sort dropdown choice field
PowerApps sort dropdown choice field

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.

Sort Dropdown Choices Alphabetically in Power Apps

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
powerapps sort alphabetically dropdown

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:

>