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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,629)