cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mrjrobinson
Frequent Visitor

Multiple filters in gallery not working

Hi All, 

 

I have added a filter to a gallery, where I can select a name from a dropdown to only show that record or by entering a Membership Number. This works if the filter is written individually,

 

  • Filter('Member Tracker',Membership_x0020_Number = MembershipNumberSearch.Text)
  • Filter('Member Tracker',Member_x0020_Name = MembersNameDropDown.Selected.Result)


but not together.

 

  • Filter('Member Tracker',Membership_x0020_Number = MembershipNumberSearch.Text || Member_x0020_Name = MembersNameDropDown.Selected.Result)

 

When I select a name from the drop down, record shows. Enter in a membership number, I have to scroll down in my list to see the record I am after as it shows 2. I would like to enter in either a membership number or select a name from a dropdown list and this display correctly.

 

All help is appreciated! 

 

Many thanks 😊 

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@mrjrobinson 

I suggest you begin by allowing the user to only to type in one search criteria.  To do this create a radio buttons control and put the following code in the Items property.

 

 

["Membership Number,"Member Name"]

 

 

Next you would put this code in the DisplayMode property of your TextInput for Membership Number.  When the Membership Number option is selected in the radio buttons the TextInput will be available for edit.

 

 

If(RadioButtons1.Selected.Value="Membership Number",Edit,View);

 

 

Similarly, put this code in the DisplayMode property of your MembersNameDropDown

 

 

If(RadioButtons1.Selected.Value="Member Name",Edit,View);

 

 

Now performing FILTER on the gallery becomes much easier.  We can use a SWITCH function to determine which criteria will be searched.  Now only the relevant records will be displayed.

 

 

Filter(
    'Member Tracker',
    Switch(
        RadioButtons1.Selected.Value,
        "Membership Number", Membership_x0020_Number = MembershipNumberSearch.Text,
        "Member Name", Member_x0020_Name = MembersNameDropDown.Selected.Result
    )
);

 

 

Hopefully this is what you were looking for.  If not, please let me know.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

6 REPLIES 6
mdevaney
Super User
Super User

@mrjrobinson 

I suggest you begin by allowing the user to only to type in one search criteria.  To do this create a radio buttons control and put the following code in the Items property.

 

 

["Membership Number,"Member Name"]

 

 

Next you would put this code in the DisplayMode property of your TextInput for Membership Number.  When the Membership Number option is selected in the radio buttons the TextInput will be available for edit.

 

 

If(RadioButtons1.Selected.Value="Membership Number",Edit,View);

 

 

Similarly, put this code in the DisplayMode property of your MembersNameDropDown

 

 

If(RadioButtons1.Selected.Value="Member Name",Edit,View);

 

 

Now performing FILTER on the gallery becomes much easier.  We can use a SWITCH function to determine which criteria will be searched.  Now only the relevant records will be displayed.

 

 

Filter(
    'Member Tracker',
    Switch(
        RadioButtons1.Selected.Value,
        "Membership Number", Membership_x0020_Number = MembershipNumberSearch.Text,
        "Member Name", Member_x0020_Name = MembersNameDropDown.Selected.Result
    )
);

 

 

Hopefully this is what you were looking for.  If not, please let me know.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Hey Mdevaney! 

 

So I have done what you have suggested and I am getting the following error on the formula "see attached image".

 

Thanks 😊 

 

@mrjrobinson 

I made a silly error.  The IF function was not necessary.  See my original post for the revised code.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Great thats working, but now the drop down for the members name has stopped. I cant click this to show the list of names when I select Members Name on the Radio Button.

 

Cheers 😊 

 

SCRATCH ALL THAT!! I have solved it, field names was spelt wrong. Thank you again for your help.

@mrjrobinson 

I've tested on my side and the code appears to work.  See my screenshot below.  Can you please share a copy of your screen?

 

xyz.PNG

OK, thanks for letting me know.  I am glad it is working for you now.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,786)