While working with the Power Apps Dropdown control, we usually need to filter the data like SharePoint list records, Collection records, and Excel items based on the dropdown selected value.
But, sometimes, we need to add an “All” option to a dropdown in Power Apps that allows users to display all the records on the other controls, i.e., [Gallery or Data table].
You can follow this Power Apps tutorial to learn how to add All option in Power Apps dropdown control with a simple example.
How to Add All Option in Power Apps Dropdown
We can add the “All” option to the Power Apps dropdown to enhance the user experience by providing a convenient option to select all items in the dropdown at once rather than selecting each item individually.
Let’s take a simple scenario: I have a SharePoint Online list, i.e., [Project Tracker]. This list contains different columns with various data types.
Column Name | Data Type |
Title | It is a default single line of text |
Description | Multiple lines of text |
Status | Choice |
Start Date | Date and time |
End Date | Date and time |
Assigned To | Person or Group |
In Power Apps, there is a Dropdown control and a Data table control.
The dropdown control retrieves all the SharePoint choice field records [Status], and the data table filters and displays each record from the SharePoint list based on the dropdown selected value.
However, I was required to add an “All” value to the dropdown, and whenever the user selects the All option in the dropdown, the data table will display all SharePoint list records.
Have a look at the below screenshot for the output.
To work around this, follow the below steps. Such as:
1. Connect a Blank canvas app to the respective SharePoint Online list [Project Tracker]. On the Power Apps Screen. Insert a Dropdown control and set its Items property as:
Items = Distinct(
'Project Tracker',
Status.Value
)
Where,
- ‘Project Tracker’ = SharePoint Online list
- Status = SharePoint list choice field
2. Then, insert a Data table control and set its Items property to the code below:
Iems = Filter(
'Project Tracker',
Status.Value = drp_Status.Selected.Value
)
Where,
- drp_Status = Power Apps dropdown name
3. Whenever the user selects any value from the dropdown, the data table will filter and display the records based on the dropdown selection like below.
4. Now, I would like to add the “All” option to the dropdown to display all the records. For that, select the specific screen and set its OnVisible property as:
OnVisible = ClearCollect(
colProjects,
{Value: "All"}
);
Collect(
colProjects,
Distinct(
'Project Tracker',
Status.Value
)
)
Where,
- colEmployee = Power Apps collection name
- {Value: “All”} = Collection Item
5. Next, select the Dropdown control and set its Items property as:
Items = colProjects
6. Select the Data table and set its Items property as:
Items = If(
drp_Status.Selected.Value = "All",
'Project Tracker',
Filter(
'Project Tracker',
Status.Value = drp_Status.Selected.Value
)
)
7. If you want to display all the SharePoint list records on the data table whenever the user opens or runs the app, you must set the Dropdown’s Default value as “All.”
Default = "All"
8. Once your app is ready, Save, Publish, Reload, and Preview the app. The data table always displays all the SharePoint list records until the user selects any other value in the dropdown control, as shown below.
This way, you can add an “All” value to the Power Apps dropdown control.
Also, you may like some more Power Apps articles:
- Display SharePoint Person or Group Column in Power Apps Dropdown
- Filter Power Apps Gallery By Multiple Dropdowns
- Hide Fields Based on Condition in Power Apps [Dropdown]
Adding an “All” option to a Power Apps dropdown is very useful for users who need to display or select all items. Also, it saves time and effort compared to selecting each item individually.
I hope this article helps you. If you have similar requirements to add an “All” option to the Power Apps dropdown, follow the above steps.
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com