Skip to main content

Notifications

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

  • renatopc84_ch Profile Picture
    renatopc84_ch 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

     

  • SteveMForm Profile Picture
    SteveMForm 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?

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

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

  • Verified answer
    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"
    )
  • renatopc84_ch Profile Picture
    renatopc84_ch 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)

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,567

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard