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 / Collection Sorting in ...
Power Apps
Answered

Collection Sorting in Power Apps

(0) ShareShare
ReportReport
Posted on by 182

I have a dropdown collection as shown below. How to get 130 first and 122 last in descending order ?

 

dropdown.png

Categories:
I have the same question (0)
  • Krishna_R Profile Picture
    525 on at

    Hi @Sajith 

     

    Have you tried 
    SortByColumnscollectionColumn Name, Descending )

  • v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @Sajith ,

    How do you create the collection? Could you please provide the formula about how do you create this collection?

    Best regards,

    Allen

  • Sajith Profile Picture
    182 on at

    Unable to use this and not sure how to use SortByColumns

  • Sajith Profile Picture
    182 on at

    The requirement is to have a blank selection. Hence I used the below formula - OnSelect of Dropdown

    ClearCollect(ERCollection,{Name:""});Collect(ERCollection,Distinct(Request,ERNos))

    Here Request is SharePoint List Name and ERNos is List Field Name.

     

    Then assigned ERCollection to Items of Dropdown.  Now I want to sort it descending.

     

     

     

  • v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @Sajith ,

    Try this:

    SortByColumns(ERCollection,"Result",Descending)

    Best regards,

    Allen

  • Sajith Profile Picture
    182 on at

    The formula -SortByColumns(EReqCollection,"Result",Descending) - works for items property of dropdown control.

    However the blank selection is coming last - ClearCollect(ERCollection,{Name:""}); Any option to make it first. Please note that one more blank is  actual value in the field.
    2021-06-13_8-47-53.png
  • Verified answer
    v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @Sajith ,

    I can understand what you mean now.

    You can directly sort the distinct results when creating this collection(except the first blank value). So try to create the collection using this code:

    ClearCollect(ERCollection,{Result:""},SortByColumns(Distinct(Request,ERNos),"Result",Descending))

    Best regards,

    Allen

  • Sajith Profile Picture
    182 on at

    The values are coming in New/Edit Form.

    However in Edit, the value stored in list column is not getting selected on Page  Load.

    2021-07-07_12-13-45.png

    Dropdown Item - ERCollection

    Dropdown OnSelect  - ClearCollect(ERCollection,{Result:""},SortByColumns(Distinct(EngineeringRequest,ERNos),"Result",Descending))

    Dropdown Default - "" 

     

    For default, ThisItem.ERRefNo is not getting selected while editing the form.

     

     

     

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard