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

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
Highlighted
Power Participant
Power Participant

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

Highlighted
Community Support
Community Support

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.
Highlighted
Microsoft
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.

Highlighted
Microsoft
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).

Highlighted
Microsoft
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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,336)