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

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard