Skip to main content
Community site session details

Community site session details

Session Id : IMU39ZrXD13uyXpmzBUZiL
Power Apps - Building Power Apps
Answered

Combo Box - Sort Selected Items Ascending

Like (0) ShareShare
ReportReport
Posted on 17 Dec 2020 22:46:01 by 117

Hi,

 

I have a combo box that is based on a Share Point Choice field. The field called ColorsSelected displays the Share Point list combo box values display in ascending order as each choice is entered into the Share Point list:

Aqua

Blue

Green

Red

Violet

Yellow

 

If a user selects Red then Blue, the 2 items show as selected (Red, Blue) and that is how they are saved when I patch the data to back to Share Point.

 

I need to patch the selected combo box values in ascending order (Blue, Red). I know SortByColumns cannot be used with Choice fields so I used the Sort command. However it is not sorting the selected items back in ascending order: 

ColorsSelected: Sort(comboboxColors.SelectedItems,"Ascending")

 

Does anyone know if this is possible? Thank you!!

Categories:
  • luvagoldenk9 Profile Picture
    117 on 22 Dec 2020 at 12:19:10
    Re: Combo Box - Sort Selected Items Ascending

    Thank you for pointing the missing parameter. I needed to add the 'Text(Value)' to my Sort statement and it worked!

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 18 Dec 2020 at 06:27:50
    Re: Combo Box - Sort Selected Items Ascending

    Hi@luvagoldenk9,

    Based on the issue that you mentioned, do you want to patch the sorted selected colors to the SP list?

    Could you please tell me that if the Combo Box is allowed multi select?

    I have a test on my side, please take a try as below:

    Add a Button and set the OnSelect property as below:

     

    Patch(
     'YourSPList',
     Defaults('YourSPList'),
     {
     'ColorsSelected ': Sort(
     ComboBox4.SelectedItems,
     Text(Value),
     Ascending
     )
     }
    )

     

    Note: In my scenario, I add a Gallery to display the 'ColorsSelected' column on time once it is updated.

    121801Gif.gif

    Regards,

    Qi

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 18 Dec 2020 at 00:31:53
    Re: Combo Box - Sort Selected Items Ascending

    @luvagoldenk9 

    Please consider changing your Formula to the following for the update to your Choice field in SharePoint:

    ForAll(SortByColumns(comboboxColors.SelectedItems, "Value"), 
     {Value: Value, 
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
     }
    )

    This will sort the values and provide the proper information to update the SharePoint column.

    I will be assuming that your Choice column allows for multiple selections.

     

    I hope this is helpful for you. 

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1