cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AHG
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
poweractivate
Community Champion
Community Champion

@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
poweractivate
Community Champion
Community Champion

@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

v-xida-msft
Community Support
Community Support

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.

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.

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

AHG
Microsoft
Microsoft

[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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,218)