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 / Take the results from ...
Power Apps
Unanswered

Take the results from two Power Automate SharePoint REST API queries that have been appended together and sort the total results by Rank

(0) ShareShare
ReportReport
Posted on by

I followed an awesome online YouTube tutorial for using Power Automate to query SPO REST API to obtain search results and send the results back to Power Apps (Search File Content  in Power Apps from SharePoint Document Libraries).  Those results are then JSON Parsed and pushed into a Table to show up in a Gallery.  The single-site-search result is sorted by Rank at the API side so no problems with the return. I then wanted to go further and create a universal search; search across two separate SharePoint sites and append the results into one mega result list creating one mega results gallery.  However, since I'm appending search2 onto search1 the larger totalsearchresults is no longer sorted by Rank.  search1 is sorted by Rank and then, separately, search2 is sorted by rank.

No big deal, sort when I'm in Power Apps?  But I can't figure it out.

 

A single-search-result:

Flow run results is placed in a variable; varSearchResults.  Flow responds to PowerApps as searchresults.

 

Gallery items is set to:

Table(ParseJSON(varSearchResults.searchresults))

 

Labels inside the Gallery: 

LookUp(Table(ThisItem.Value.Cells),ThisRecords.Value.Key="Title").Value.Value

LookUp(Table(ThisItem.Value.Cells),ThisRecords.Value.Key="Rank").Value.Value

etc...

 

The actual search results in JSON look basically like:

{"Cells":[

     { "Key" : "Title",

        "Value": "TitleOfThing"

     },

     {"Key":"Rank",

      "Value":"900"

    }

           ]

 

and so on.  However, I can't figure out how to Sort or SortByColumns in the Gallery Items (aka Table(ParseJSON(varSearchResults.searchresults) to sort the entire large multi-site-search return by Rank.  When I append search1 and search2 together and substring it out so it can Parse correctly in Power Apps, thereby creating a multi-site-search result,  the second search might have an item of Rank 999 but it gets pushed to the bottom of the line in the Gallery when it may be the true first in line.

Hopefully that all makes sense and hopefully someone can be of help?

 

 

Categories:
I have the same question (0)

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 531 Most Valuable Professional

#2
Haque Profile Picture

Haque 261

#3
Kalathiya Profile Picture

Kalathiya 221 Super User 2026 Season 1

Last 30 days Overall leaderboard