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

Filter gallery by search and dropdown

This question has been asked repeatedly but I'm having a hell of a time implementing the provided solutions and keep confusing myself. When I think I'm getting close, something falls apart so I'm at the point of asking for specific help.

 

I have a gallery populated from a SharePoint list I would like to do the following with:

 

  • Search by Title (StartsWith is fine)
  • Filter using a dropdown linked to a secondary field 'Status'. This is a choice field with five options.
    • The dropdown I use draws values with the Choices formula, and I think this may be messing me up.
  • A way to select all or reset the dropdown - I can't seem to figure out a way to select a blank value in the dropdown.

I think the way to do this is through a collection but I've reached my wit's end. Let me know the best way forward.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Filter gallery by search and dropdown

Hi @BarvoDelancy,

 

try this:

If(DropdownName.Selected.Value="All",Filter('SP list', StartsWith(Title,SearchInput.Text)),Filter('SP list', StartsWith(Title,SearchInput.Text), Status.Value=DropdownName.Selected.Value))

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

7 REPLIES 7
Highlighted
Community Support
Community Support

Re: Filter gallery by search and dropdown

Hi @BarvoDelancy ,

 

For your first two requirements, please try this code.

Filter('SP list', StartsWith(Title,SearchInput.Text), Status.Value=DropdownName.Selected.Value)

For your third requirement:

To select all, you need to add 'All' value to the Items property of dropdown, please put the following code to App.OnStart property: 

ClearCollect(AllChoices,Choices('SP list'.Status),{Value:"All"})

Then, Select AllChoices collection as the Items of Dropdown.

Snipaste_2020-07-27_13-58-57.png

 

If you want to select blank in dropdown, please try to set the AllowEmptySelection property of dropdown to true, then it will work.

Hope this helps.

Sik

Highlighted
Super User III
Super User III

Re: Filter gallery by search and dropdown

Hi @BarvoDelancy,

 

I agree with @v-siky-msft , but only a small change:

ClearCollect(AllChoices,{Value:"All"},Choices('SP list'.Status))

KrishnaV_0-1595830681736.png

 

This will give you the All on top of the dropdown list. 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Highlighted
Super User III
Super User III

Re: Filter gallery by search and dropdown

Hi @BarvoDelancy ,

 

Just a small change for filter all:

Filter('SP list', StartsWith(Title,SearchInput.Text), If(DropdownName.Selected.Value<>"All",Status.Value=DropdownName.Selected.Value))

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Highlighted
Frequent Visitor

Re: Filter gallery by search and dropdown

Thank you so much for the help thus far @v-siky-msft  and @KrishnaV I am now 90% of the way there. The drop down filter works along with the search and adding 'all' to the top of the drop down significantly improves the user experience.

 

However the 'All' filter appears to filter everything out. So the gallery is blank when I select the All option as opposed to showing no filter. Also I get a delegation warning when using KrishnaV's recommended gallery formula.

 

BarvoDelancy_0-1595833384164.png

BarvoDelancy_1-1595833397336.png

 

Here are my formulas in case there's an error I'm missing.

 

OnVisible for the Screen:

 

ClearCollect(AllChoices,{Value:"All"},Choices('Vendor Setup'.Status))

 

Items for my Gallery:

 

Filter('Vendor Setup', StartsWith(Title,SearchVendorTitle.Text), If(DropdownStatus.Selected.Value<>"All",Status.Value=DropdownStatus.Selected.Value))

 

Items for my Dropdown:

 

AllChoices

Highlighted
Super User III
Super User III

Re: Filter gallery by search and dropdown

Hi @BarvoDelancy,

 

try this:

If(DropdownName.Selected.Value="All",Filter('SP list', StartsWith(Title,SearchInput.Text)),Filter('SP list', StartsWith(Title,SearchInput.Text), Status.Value=DropdownName.Selected.Value))

 
I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Highlighted
Community Support
Community Support

Re: Filter gallery by search and dropdown

Hi @BarvoDelancy ,

Try to move the If logic out of the Filter function. Please try this.

If(
DropdownStatus.Selected.Value<>"All", 
Filter('Vendor Setup', StartsWith(Title,SearchVendorTitle.Text), Status.Value=DropdownStatus.Selected.Value),
Filter('Vendor Setup', StartsWith(Title,SearchVendorTitle.Text))
)

 Hope this helps.

Sik

Highlighted
Frequent Visitor

Re: Filter gallery by search and dropdown

It works! Thank you so much to both of you @v-siky-msft and @KrishnaV . Adjusting the If function seemed to be the fix. Since both worked I'll grant solution to Krishna for the slightly earlier post. I sincerely appreciate the time you've taken.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,749)