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

Filter gallery by button

I have created a set of buttons to filter the gallery, but the problem is whenever clicked it keeps getting stacked on top of each filter. 

 

Items - Gallery

SortByColumns( Filter( [@'Pricing Deliveries'], StartsWith( 'Engagement Name', TextSearchBox1.Text ), If( FilterByStatus_NotYetStarted = true, 'Delivery Status'.Value = "1. Not yet started", FilterByStatus_Preparation = true, 'Delivery Status'.Value = "2. In Progress - Preparation", FilterByStatus_InReview = true, 'Delivery Status'.Value = "3. In Progress - Review", FilterByStatus_Completed = true, 'Delivery Status'.Value = "Completed - Delivered", FilterByStatus_Cancelled = true, 'Delivery Status'.Value = "Cancelled", 'Delivery Status'.Value <> "" ), 'Created By'.Email = User().Email ), "Title", If( SortDescending1, Descending, Ascending ) ) 

 

OnSelect - Button

UpdateContext({FilterByStatus_NotYetStarted:!FilterByStatus_NotYetStarted})

 

1 ACCEPTED SOLUTION

Accepted Solutions
BCBuizer
Super User
Super User

Hi @danielle365 ,

 

The issue is that you are using different variables for each status. Please consider changing your filter to using a single variable only:

 

SortByColumns( 
	Filter( 
		[@'Pricing Deliveries'],
		StartsWith( 'Engagement Name', TextSearchBox1.Text ),
		If(
			IsBlank(FilterByStatus),
			true,
			'Delivery Status'.Value = FilterByStatus
		),
		'Created By'.Email = User().Email 
	),
	"Title",
	If( 
		SortDescending1, 
		Descending, 
		Ascending 
	) 
) 

 

The value of the single variable (FilterByStatus) can then be set using the OnSelect property of the respective buttons:

Set(FilterByStatus,"1. Not yet started")
Set(FilterByStatus,"2. In Progress - Preparation")
Set(FilterByStatus,"3. In Progress - Review")
Set(FilterByStatus,"Completed - Delivered")
Set(FilterByStatus,"Cancelled")

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

View solution in original post

2 REPLIES 2
BCBuizer
Super User
Super User

Hi @danielle365 ,

 

The issue is that you are using different variables for each status. Please consider changing your filter to using a single variable only:

 

SortByColumns( 
	Filter( 
		[@'Pricing Deliveries'],
		StartsWith( 'Engagement Name', TextSearchBox1.Text ),
		If(
			IsBlank(FilterByStatus),
			true,
			'Delivery Status'.Value = FilterByStatus
		),
		'Created By'.Email = User().Email 
	),
	"Title",
	If( 
		SortDescending1, 
		Descending, 
		Ascending 
	) 
) 

 

The value of the single variable (FilterByStatus) can then be set using the OnSelect property of the respective buttons:

Set(FilterByStatus,"1. Not yet started")
Set(FilterByStatus,"2. In Progress - Preparation")
Set(FilterByStatus,"3. In Progress - Review")
Set(FilterByStatus,"Completed - Delivered")
Set(FilterByStatus,"Cancelled")

 



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

Works like a charm, thank you so much! 🙂

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (2,209)