cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AndersIskov
Level: Powered On

Filter Browse Gallery with Buttons with "Set"

Hi,

 

My fairly simple app has a variety of possible data that can be added/edited/viewed. When editing/adding a new item users are asked to give the "Phase" as seen below:

 

FilterByPhase3.png

 

 

 

 

 

 

 

 

 

 

 

 

In my Browsegallery1 (seen below) I would like to be able to filter by either each individual "Phase" or to see "All":

 

FilterByPhase.JPG

 

I have found a template, which is provided by PowerApps in which they use the Set() Function with Set(PhaseStatus, "Lead"):

 

FilterByPhase4.JPGFilterByPhaseExample.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

However, it does not filter when I try to use the different buttons. What am I missing? If someone can help, would you also tell me how to be able to fx. press "All" and then it shows all the items again?

 

Kind regards

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Filter Browse Gallery with Buttons with "Set"

@anderslskov
Yes except you’ve added an extra bracket beside MainTable that should be removed

SortByColumns(Search(Filter(MainTable, PhaseStatus = "All" Or Phase=PhaseStatus), TextSearchBox1.Text, "Account"), "Account", If(SortDescending1, Descending, Ascending))

View solution in original post

12 REPLIES 12
Super User
Super User

Re: Filter Browse Gallery with Buttons with "Set"

@AndersIskov 

You would still need to put some code like this in your BrowseGallery1's Items property

 

If(
  PhaseStatus="All",
  your_datasource_name
  Filter(your_datasource_name,Phase=PhaseStatus)
)

 

If Phase is a Choices type SharePoint column you might need to replace Phase with Phase.Value instead.

 

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

 

 

AndersIskov
Level: Powered On

Re: Filter Browse Gallery with Buttons with "Set"

Hi Mdevaney,

 

Right of course. First I should mention: I am solely using an excelsheet with a "MainTable" where all data is stored and assisting tables with information that I use for various DropDowns fx. "Phase" (I assume this is the your_data_source that you mention in the formula), which has different phases such as "Lead","Opportunity","Proposal Dev", etc.

 

I have tried to add your formula to the BrowseGallery1's Items property with little success:

 

FilterByPhase5Example.JPGFilterByPhase6.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I also looked at the Template from PowerApps, here they use Or(), I also tried that but can't seem to get it working.

 

 

Super User
Super User

Re: Filter Browse Gallery with Buttons with "Set"

@AndersIskov 

Maybe my code can be simplified even more.  Put this code in the Items property of your Gallery.

Filter(your_datasource_name,PhaseStatus="All" Or Phase=PhaseStatus)

 

If it does not work provide the full error message for the Items property. 

 

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

AndersIskov
Level: Powered On

Re: Filter Browse Gallery with Buttons with "Set"

@mdevaney 

 

This is the error I receive:

 

FilterByPhase7.JPG

Super User
Super User

Re: Filter Browse Gallery with Buttons with "Set"

@AndersIskov 

You must replace

Search([MainTable]

 

With my code

Search(Filter([MainTable],PhaseStatus="All" Or Phase=PhaseStatus)

 

And remove my code from the end of your formula

 

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

AndersIskov
Level: Powered On

Re: Filter Browse Gallery with Buttons with "Set"

I really appreciate you keep trying to help such a beginner like me. I have tried many different things now, but still gives me an error 😞

 

FilterByPhase8.JPG

 

 

 

I have tried with Sort(), ShowColumn(), etc. It keeps giving me an error.

Super User
Super User

Re: Filter Browse Gallery with Buttons with "Set"

@AndersIskov 

It looks like you erased all your code.  That was not my intention.  You should replace only the section I specified with my 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."

AndersIskov
Level: Powered On

Re: Filter Browse Gallery with Buttons with "Set"

Like this(?): SortByColumns(Search(Filter(MainTable), PhaseStatus = "All" Or Phase=PhaseStatus), TextSearchBox1.Text, "Account"), "Account", If(SortDescending1, Descending, Ascending))
Super User
Super User

Re: Filter Browse Gallery with Buttons with "Set"

@anderslskov
Yes except you’ve added an extra bracket beside MainTable that should be removed

SortByColumns(Search(Filter(MainTable, PhaseStatus = "All" Or Phase=PhaseStatus), TextSearchBox1.Text, "Account"), "Account", If(SortDescending1, Descending, Ascending))

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (2,413)