TL;DR: Add IsBlank(YourFilterInput) to a gallery’s Filter so it shows every item when the search box is empty.
💡 Challenge
Filtering galleries in PowerApps based on user input (like text input, dropdown, or combo box) is common, but when the input is empty you usually want to show all items.
✅ Solution
Add an || IsBlank(YourFilterInput) condition to your filter formula.
🔧 How It’s Done
-
Create a gallery and set up your filter inputs (e.g., text input, dropdown, combo box).
-
Apply the following formula to your gallery’s Items property:
Filter(YourDataSource, Condition || IsBlank(YourFilterInput))🔸
YourDataSourceis the source of your data. 🔸Conditionis your filtering condition (e.g.,TextInput.Text = ThisItem.Field). 🔸YourFilterInputis the input control (e.g., TextInput, Dropdown).
🎉 Result
When the filter input is empty, the gallery shows all items. If the input is provided, the gallery filters based on the specified condition.
🌟 Key Advantages
🔸 Simplifies gallery filtering logic.
🔸 Enhances user experience by dynamically displaying all or filtered data.
🔸 Reduces the need for multiple filtering conditions.
🎥 Video Tutorial
🛠️ FAQ
1. Can I use multiple filter conditions with the IsBlank() check?
| Yes, you can combine multiple conditions using && or | operators while still including the IsBlank() check for each filter input. |
2. Does this technique work with all data sources in PowerApps?
Yes, this filtering approach works with SharePoint lists, Dataverse tables, SQL databases, and other supported data sources.
3. How can I handle multiple filter inputs simultaneously?
Create compound conditions like: Filter(DataSource, (Condition1 || IsBlank(Input1)) && (Condition2 || IsBlank(Input2))).