web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combobox - Sort picked...
Power Apps
Answered

Combobox - Sort picked items alphabetically

(0) ShareShare
ReportReport
Posted on by 62

Hi I have a combobox and i need the chosen items to be displayed in the combobox display at the top in alphabetically order, i.e.

 

Say I have a combobox with dropdown list as follows,

["Y", "B", "A", "R", "G"]

 

The Combobox is set to accept muliple selections so if someone sleects "G", "B", "Y" the combo box will display "G B Y" but I want it to sort these so thye would display as "B G Y"

 

The reason for this is I have a button that when pressed it compares the selected combobox items and then naviagtes to another screen if the selected ietms match, the problem though is the items display in the order they are selected so this gives many variations, hence why I want them to sort.

 

Many thanks

Categories:
I have the same question (0)
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Newbeetle1 Before you do u'r comparison, do a sort...

    Sort(ComboBox1.SelectedItems, Value))

    CNT_0-1620933176055.png

     

  • Newbeetle1 Profile Picture
    62 on at

    Hi CNT

    I set a combobox called Answer2 and selected G Y B from the list.

    Newbeetle1_0-1620935117134.png

     

    I have added a button and the command

    Sort(Answer2.SelectedItems, Value)

    When I press the button the selected items stay as G Y B and do not re-order.

     

    Any ideas?

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Newbeetle1  we cannot use sort in any of the ComboBox properties as this will create a circular reference error. Collect the Sorted results into a collection in the OnSelect() of the Button.

    ClearCollect(myCollection, Sort(Answer2.SelectedItems, Value))

    Use this collection to do u'r comparisons instead of using the SelectedItems from the ComboBox.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Newbeetle1 

    You seem to be referring to sorting the items in the combobox selection list itself.  If this is the case, you cannot sort them in that list.  They will appear in the order selected.  

    However, you can sort the items anywhere else in your app that come from those selections and if you are storing them and setting the DefaultSelectedItems property later to show them again, they will/can be sorted.

    Just that you cannot have the immediate selections sorted.

  • Newbeetle1 Profile Picture
    62 on at

    Hi CNT,

     

    Many thanks, as you can probably tell I'm fairly new to this, I will read up on myCollection and then follow your lead.

  • Newbeetle1 Profile Picture
    62 on at

    Hi Randy,

    Many thanks, I shall do some more reading around this and give this another go.

  • Newbeetle1 Profile Picture
    62 on at

    Hi CNT,

     

    I persevered and glad to say I got there, I created the collection using sort as suggested, many thanks.

  • Newbeetle1 Profile Picture
    62 on at

    Hi Randy,

     

    Many thanks I used a label to pull through the combobox collection into a string and that worked as required.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard