Handle empty combobox when filtering Galleries in Power Apps

When you are using a combobox to filter a gallery based on the selection, you can check if the selection is blank or not, and depending on that, show only the records that match the combobox selection or show all records.

For below scenario, we want to filter the Category of each record based on the selection in the combobox.

Below could be used for that purpose:

BUT there is a cleaner and simpler way to achieve this in Power Apps, all in a single line of code:

				
					Filter('App Usage', category=cmbCategory.Selected.Value || IsEmpty(cmbCategory.Selected.Value) || IsBlank(cmbCategory.Selected.Value)) 
				
			

All done! Use this tip to keep your app code clean and easy!



Leave a Comment

Your email address will not be published. Required fields are marked *