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 / Filter Gallery by Fold...
Power Apps
Unanswered

Filter Gallery by Folder path and by Gallery1.Selected

(0) ShareShare
ReportReport
Posted on by 1,512

I have a gallery (Gallery1) that is connected to my Customers list.  I select that and want the next Gallery (Gallery3) to display all of the documents in the Documents_1 list by the customer selected.  I have on Gallery 3 this code

 

SortByColumns(
 Filter(
 Documents_1,
 'Folder path' = varFolderPathCurrent
 ),
 "{IsFolder}",
 Descending,
 "{Name}",
 Ascending
)

 

Which works well if it is a direct connection to the documents library.  The issue is that the contents of the documents library will change based on the customer selected.

 

I tried to add this code as the second condition to the filter but it is not working.

CompanyName=Text(Gallery1.Selected.'{Name}')

 

What do I need to do to get this working?

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Dorinda 

    For the criteria you added to your Formula - is CompanyName a column in your doc library?  What is the field of the Gallery that would match that?

     

    Also, keep in mind that filtering a Document library by the fields you are is not delegable, so if your library grows to over 2000 records, you will experience issues. And it is important to keep in mind that document libraries do not have "folders" - folders are emulated in the list.  So, one might think...I am good for delegation because my "folder" in the library only has 100 documents in it, but if there is, let's say, another folder in the library that has 2000 documents in it, then your library really has 2100 items and delegation is a necessity. 

     

     

  • Dorinda Profile Picture
    1,512 on at

    @RandyHayes 

    CompanyName matches to the CompanyName in gallery 1 I have made it a parent child like you taught me just dont know how to add the filter to the existing code

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Dorinda 

    Yes, so what, in your library, identifies the CompanyName?  In your existing Formula you seemed to indicate that CompanyName was the column in your library and {Name} was what held the Company Name in your Gallery.  But I do not believe that is correct.  

    So, what is the Items of Gallery1?  And what column in the Items of Gallery1 denotes the CompanyName?

    And then, what column in your library contains the Company Name?

  • Dorinda Profile Picture
    1,512 on at

    @RandyHayes  in my document library the field is Company name and the field in my list is Title, sorry for the confusion.

    Hope that helps

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Dorinda 

    Then that is what you need for the criteria.

    SortByColumns(
     Filter(Documents_1,
     'Folder path' = varFolderPathCurrent,
     CompanyName = Gallery1.Selected.Title
     ),
     "{IsFolder}",
     Descending,
     "{Name}",
     Ascending
    )

     

    Just again keep in mind - columns like {IsFolder} and {Name} are all calculated columns on SharePoint and you cannot delegate criteria to them.

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard