cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft AHG
Microsoft

Clearing Filters from a Gallery or Showing all Line Items from the Source Data

I have a gallery that I created from an Excel (OneDrive for Business) source that's in the form of the Power Apps Service Desk template. I set up the Filters Gallery as well as a Search button to filter the gallery ("Tickets Gallery") in different ways.

 

The problem I have right now is that when I filter it, I have no way of getting it back to showing all tickets or all items in my source.

 

I've tried:

  • Using the Reset function;
  • Using the Refresh function;
  • Adding nested If and Filter functions in addition to the ones I already have for telling the gallery to show items based on the Search bar or the Filter Gallery, depending on what the user clicks;
  • Adding a column in the source Excel with a value that all of the items have and trying to add a Filter function that tells the Ticket Gallery to show all items that have that value if the Reset button is clicked; and
  • Various formula attempts on a Reset button.

but haven't gotten anything to work.

 

I've attached a screenshot (with blurred data).

1 ACCEPTED SOLUTION

Accepted Solutions
dynamicsedge
Level 10

Re: Clearing Filters from a Gallery or Showing all Line Items from the Source Data

@AHG 

 

Here's one approach you can try:

 

Your reset button's OnSelect property should set a text variable to "" (empty text), such as like this: Set(FilterVariable,"")

 

Then your Items property of Gallery should be like this:

 

If(IsBlank(FilterVariable),DataSource,Filter(DataSource,YourFilterHere))

 

Above example Items will show all items for the data source if the search variable text is blank. If it is not blank, it will use the Filter instead.

 

Also, you may need:

Make the OnChange property of your search field to set the variable when value is changed - like this:

Set(FilterVariable, YourControl.Text)

 

See if something like the above helps.

 

 

View solution in original post

5 REPLIES 5
dynamicsedge
Level 10

Re: Clearing Filters from a Gallery or Showing all Line Items from the Source Data

@AHG 

 

Here's one approach you can try:

 

Your reset button's OnSelect property should set a text variable to "" (empty text), such as like this: Set(FilterVariable,"")

 

Then your Items property of Gallery should be like this:

 

If(IsBlank(FilterVariable),DataSource,Filter(DataSource,YourFilterHere))

 

Above example Items will show all items for the data source if the search variable text is blank. If it is not blank, it will use the Filter instead.

 

Also, you may need:

Make the OnChange property of your search field to set the variable when value is changed - like this:

Set(FilterVariable, YourControl.Text)

 

See if something like the above helps.

 

 

View solution in original post

Community Support Team
Community Support Team

Re: Clearing Filters from a Gallery or Showing all Line Items from the Source Data

Hi @AHG ,

Could you please show more details about the formula you specified within the Items property of the TicketsGallery?

 

Based on the needs that you mentioned, I think a global variable could achieve your needs. You could consider take a try with the following workaround:

Add following formula within the OnSelect property of the Group1 control:

Set(CurrentSelectedOption, ThisItem.TicketTypes)

Add a "Reset" button, set the OnSelect property to following:

Set(CurrentSelectedOption, Blank())

Set the Items property of TicketsGallery to following:

If(
    IsBlank(CurrentSelectedOption),
    TicketsCollect1,    // TicketsCollect1 represents the data source you want to display within the TicketGallery
    Filter(TicketsCollect1, ....)
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Microsoft AHG
Microsoft

Re: Clearing Filters from a Gallery or Showing all Line Items from the Source Data

Please see the attached for a screenshot of how I have the formula right now. You recommended setting a Global Variable like the previous post, but I can't seem to get it to work as another nested "IF" statement within the already established Items formula.

 

Note that I also blocked out some content for privacy, but you can easily see the structure of the formula.

Microsoft AHG
Microsoft

Re: Clearing Filters from a Gallery or Showing all Line Items from the Source Data

I just posted this in reply to the second suggestion on this thread and will mention again here that, even with an established variable, I cannot seem to get another nested "IF" statement in the Items formula for the gallery. See the attached image (some info blocked out for privacy).

Microsoft AHG
Microsoft

Re: Clearing Filters from a Gallery or Showing all Line Items from the Source Data

[UPDATE] the solution seems to be a combination of a variable + reset action on the button that resets the Search Box after clearing the Variable (i.e., making it blank).

 

OnSelect event for the button = Set(<Global Variable>,Blank());Reset(<Search Box>)

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,940)