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 / Gallery filtered by Fi...
Power Apps
Answered

Gallery filtered by Filter, Search, If

(0) ShareShare
ReportReport
Posted on by 13

I am a frequent visitor of this forum and it is the first time when I couldn't find an answer (or at least not one that explains the solution at my rookie level). I've been fighting this for 2 straight days then I finally decided to post it here ... any help is appreciated.

 

I have the following canvas:

 

FirstTeacher_5-1676003943789.png

Based on selection (1), one of the options becomes visible (2) and the results are displayed in the gallery (3).

 

The gallery's Items=

If(DropdownSearchBy.Selected.Result="Name",Search('Document Ctrl',TextInputSearchName.Text,"Name"),
If(DropdownSearchBy.Selected.Result="Category",Filter('Document Ctrl',Category.Value=DropdownCategory.Selected.Value),
If(DropdownSearchBy.Selected.Result="Location",Search('Document Ctrl',DropdownLocation.SelectedText.Value,"Location"),
Search('Document Ctrl',DropdownDepartment.SelectedText.Value,"Department"))))

 

I also tried gallery's Items=

Filter('Document Ctrl',Status.Value="Approved")

 

Separately, they both work like a charm but I need to combine them: I need to have the gallery filtered for "Approved" and then by one of the 4 options.

 

- (1) DropdownSearchBy has 4 options: Name, Category, Location, Department

- (2) The equivalents (made visible as selected in (1)) are:

-- TextInputSearchName <text input>

-- DropdownCategory <Items=Choices([@'Document Ctrl'].Category)>

-- DropdownLocation <Items=Distinct('Document Ctrl',Location)>

-- DropdownDepartment <Items=Distinct('Document Ctrl',Department)>

- (3) The gallery name is: GalleryDocumentCtrlSearch

- Data source is a SP List named 'Document Ctrl' and the settings are:

 

FirstTeacher_6-1676005238496.png

I hope I posted enough info for a solution (and if not ... I will provide more, as needed).

As a "first time poster", I am so looking forward to mark it as "ACCEPTED SOLUTION". Thank you in advance for your efforts

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

    Hi @FirstTeacher ,

    Try this - I have tried to maximise Delegation capability (the top filter needs to return record numbers under you limit). Also you have a couple of Search functions on drop-downs - if they are a full match with the field, you only need equals - also note SelectedText is Deprecated.

    With(
     {
     wData:
     Filter(
     'Document Ctrl',
     Status.Value = "Approved"
     )
     },
     Filter(
     wData,
     Switch(
     DropdownSearchBy.Selected.Result,
     "Name",
     TextInputSearchName.Text in Name,
     "Category",
     Category.Value = DropdownCategory.Selected.Value,
     "Location",
     DropdownLocation.Selected.Value in Location,
     DropdownDepartment.Selected.Value in Department
     )
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • FirstTeacher Profile Picture
    13 on at

    Thank you so much!

    The only thing that I had to change was the "Value" to "Result" but otherwise it's doing the magic 🙂

     

    FirstTeacher_0-1676009228042.png

     

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

    @FirstTeacher ,

    No problems - happy to help. I got the .Value references from your posted question, so I assumed they were correct.

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

    @FirstTeacher ,

    No problems - happy to help. I got the .Value references from your posted question, so I assumed they were correct.

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

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard