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 / Filtering a document l...
Power Apps
Answered

Filtering a document library gallery based on title in a collection

(0) ShareShare
ReportReport
Posted on by 58

I've figured out how to get results from the Sharepoint's Search REST API into my powerapp. To do so I create a collection for the returned document titles from the search. What I can't figure out is how to filter my gallery based on the Title column in the collection. 

 

In the Items for the gallery I have Filter(DocLibrary, Title in _apiResults.Title)

 

Then in onChange for the text input search box, I have ClearCollect(_apiResults,SPSearchAPI.Run(tbSearchInput.Text))

 

SPSearchAPI is the Flow that does the http get request, then parses the data and returns just the titles that returned in the search. 

 

When I type in a search term, I do get results, but they don't match all of the results in the collection. Some do, but some don't. For instance, for one search the collection has two results, but only one is displayed in the gallery. Can anybody help?

 

Thank you!

Categories:
I have the same question (0)
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @caitlink 

     

    • Does the search through Power Automate is accurate? It means is it searches Startswith or contains?
    • Filter the gallery based on the search results

    I suggest verifying the SharePoint API search? Can you Share your search term on the search?

     


    Thanks,
    Stalin - Learn To Illuminate

  • caitlink Profile Picture
    58 on at

    Thanks for your reply! Here's the Flow I'm using. Screenshot 2021-11-23 at 15.49.33.png

     

    It passes the Titles back to the Collection just fine. So for example, if two items are passed back through the Flow, the collection contains those two titles. However, only one of the two items displays in the gallery. I'm wondering if maybe it has to do with the actual naming - some of the titles contain spaces, and others don't. Maybe it would be better to pass back something else, like the UniqueID or DocID.

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @caitlink 

     

    To further troubleshoot, Insert another gallery and set the Items property to

    _apiResults

     

    to compare the titles.

     

    With({Item:DocLibrary},
    Filter(Item, Title in _apiResults.Title)
    )

     

  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @caitlink 

     

    I tested with mockup collection and works

     

    StalinPonnusamy_0-1637689493102.png

     

    StalinPonnusamy_1-1637689518221.png

     

    Note: With my Datasource, I used Name.


    Thanks,
    Stalin - Learn To Illuminate

  • caitlink Profile Picture
    58 on at

    Thanks for your help. It doesn't work. The items showing in the gallery are not the same as the items returned to the collection. In some cases it's just missing some items, in other cases it shows nothing at all, and in still other cases it shows some items that are in the collection and items that aren't in the collection. 

  • caitlink Profile Picture
    58 on at

    I figured out the issue! It had to do with having a Title value in addition to a Name value. When I removed all the titles (leaving only Name), it works fine. Your comment helped, thanks!

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard