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 / Correct Code for Using...
Power Apps
Answered

Correct Code for Using Multiple filters with Gallery

(0) ShareShare
ReportReport
Posted on by 118

I need some help getting the right combination of code across screen for a combination of filter controls to work with a gallery.

 

History:

 

1. Built screen and gallery- all good

2. Added search Text Input box and updated Gallery code:

 

Search('Work Tracker', SearchInput1_1.Text, "hh")  where 'Work Tracker' = SP List source, and "hh" is column name for title of work.

 

All works fine on the search

 

3. Added dropdown with following code:

 

Distinct('Work Tracker','Deputy Director'.DisplayName)  where Deputy Director is email address from a Person Column type 

 

4. Updated Gallery code:

 

Search(
Filter('Work Tracker', 'Deputy Director' = Dropdown1.Selected.Value),
SearchInput1_1.Text, "hh"
)

 

Stopped working.

 

Even in dev, values for items in labels etc displaying info has disappeared and nothing showing on preview and search and dropdown box not working.

 

The labels etc generally use 'ThisItem'  to display text egThisItem.'Title of Work'

 

I am guessing I have missed something on the Gallery set up but am stumped. I'll also need to add another 2 filters as well as the search and drop down.

 

Thanks

Categories:
  • renatopc84_ch Profile Picture
    228 on at

    Hi @SteveMForm 

    I suppose that is the search.

    My proposal is to change the Gallery Filter, something like:

     

    If(

    Len(SearchInput1_1.Text)>1,

    Filter('Work Tracker', 'Deputy Director' = Dropdown1.Selected.Value && SearchInput1_1.Text in "hh"),

    Filter('Work Tracker', 'Deputy Director' = Dropdown1.Selected.Value)

     

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @SteveMForm

    Since 'Deputy Director'is Person column, yuo need to refer to as below:

    Search(
    Filter('Work Tracker', 'Deputy Director'.DisplayName = Dropdown1.Selected.Value),
    SearchInput1_1.Text, "hh"
    )
  • SteveMForm Profile Picture
    118 on at

    So simple, of course! Many thanks @v-qiaqi-msft !

  • SteveMForm Profile Picture
    118 on at

    Thanks for your help @renatopc84_ch . 

     

    With your code, is that to handle if the search is blank? How would I handle the dropdown being blank as well. and any other additional filters?

  • renatopc84_ch Profile Picture
    228 on at

    Hi @SteveMForm 

    yes so you are handling if the search is blank.

    If you want to manage also the empty dropdown

    If(

    Len(SearchInput1_1.Text)>1,

    Filter('Work Tracker', 'Deputy Director' = Dropdown1.Selected.Value || SearchInput1_1.Text in "hh"),

    Filter('Work Tracker', 'Deputy Director' = Dropdown1.Selected.Value)

     

    You can manage additional filters grouping with AND / OR conditions

     

    && = AND

    || = OR

     

    if you have a specific example, please provide the exact names

     

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard