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 / alphabetize a collecti...
Power Apps
Answered

alphabetize a collection from multiple datasources

(0) ShareShare
ReportReport
Posted on by

I am stumped on where to put by sort or sortbycolumns function in order to sort my entire collection in alphabetically order.  Here is the code that works to sort my first group of data followed by my second group of data.  I want the collection to sort alphabetically in it's entirety.  Thanks for the help.

 

Collect(CollLIN, SortByColumns(Distinct(Filter('FPC-Purchase Orders','Change Funding Source' = VarFund),'Line Item Value'),"Result"));
Collect(CollLIN, SortByColumns(Distinct(Filter('Archive PO List',Funding_x0020_Source = VarFund),Line_x0020_Item_x0020__x0023_),"Result"))

 

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @cmegow ,

    You cannot do this in one statement as the joining of the collections cannot be incorporated with a Sort statement, however as you are collecting anyway, you can do this

    With(
     {
     wCol1:
     Distinct(
     Filter(
     'FPC-Purchase Orders',
     'Change Funding Source' = VarFund
     ),
     'Line Item Value'
     ),
     wCol2:
     Distinct(
     Filter(
     'Archive PO List',
     Funding_x0020_Source = VarFund
     ),
     Line_x0020_Item_x0020__x0023_
     )
     },
     ClearCollect(
     ColTemp,
     wCol1,
     wCol2
     )
    );
    ClearCollect(
     CollLIN,
     Sort(
     colTemp,
     Result
     )
    );
    Clear(colTemp)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • cmegow Profile Picture
    on at

    @WarrenBelz Thank you so much, I never would have gotten there on my own.  I even added in my "Any" text into the final ClearCollect to make the filters work correctly on my gallery that this dropdown controls.  Big huge Thank You!

  • cmegow Profile Picture
    on at

    @WarrenBelz I tried to duplicate this logic on another screen, and I'm running into a road block. In the example above, imagine that the 'PO Line Item Value' is a number column in SP.  The collection doesn't like text and numbers together.  How do I convert my number to text?  I've tried putting the Text() function in about all the places I can think of with no luck.  Thanks for any guidance you can offer.

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @cmegow ,

    Can you please post (in text) the code you are using and also a bit of an explanation of why you need the numbers and text together.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 226 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard