cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Super User
Super User

Re: Multiple filters in gallery not working

@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
Super User
Super User

Re: Multiple filters in gallery not working

@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

mrjrobinson
Frequent Visitor

Re: Multiple filters in gallery not working

Hey Mdevaney! 

 

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

 

Thanks 😊 

 

Super User
Super User

Re: Multiple filters in gallery not working

@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."

mrjrobinson
Frequent Visitor

Re: Multiple filters in gallery not working

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.

Super User
Super User

Re: Multiple filters in gallery not working

@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

Super User
Super User

Re: Multiple filters in gallery not working

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

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,000)