web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building 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

I have the same question (0)
  • renatopc84_ch Profile Picture
    228 on at
    Re: Correct Code for Using Multiple filters with Gallery

    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
    on at
    Re: Correct Code for Using Multiple filters with Gallery

    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
    Re: Correct Code for Using Multiple filters with Gallery

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

  • SteveMForm Profile Picture
    118 on at
    Re: Correct Code for Using Multiple filters with Gallery

    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
    Re: Correct Code for Using Multiple filters with Gallery

    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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 624 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 384 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 246

Last 30 days Overall leaderboard