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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection Sorting in ...
Power Apps
Unanswered

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
    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
    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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard