This Power Apps tutorial will discuss, how to change a Power Apps Data Card to a dropdown control.
Recently, I was working on a requirement where I needed to change Power Apps DataCard to a dropdown. To achieve this need, we will follow the below instructions.
Power Apps change DataCard to dropdown
Here, we will discuss how to change the Power Apps DataCard to dropdown control.
Requirement:
When the user clicks on the Manager data card instead of a text field it will appear as a dropdown control.
Additionally, when the user selects an option from Manager’s dropdown control and clicks on the Save button, the data will save to the specified SharePoint list.
Here, we have a SharePoint list named Employees, which has several columns such as:
- Employee Name: People Picker column
- Address: Single line of text
- Contact: Number
- Join Date: Date and Time
- Department: Choice column
- Manager: Single line of text
To fulfill the requirement, now we will create a Power Apps edit form (i.e., Employee Registartion) using the above-mentioned SharePoint list (Employees).
To create an edit form within the Power Apps, the following steps are required:
- On the Power Apps, build a blank canvas app.
- It will redirect to a Power Apps screen, where the form will build.
- Connect the app with the SharePoint list (Employees).
- Again, go to Insert tab > Edit form. A blank edit form will appear on the screen.
- Connect that edit form to the SharePoint list as the data source or you can select the edit form and insert the SharePoint list name on the edit form’s DataSource property.
DataSource = Employees
Once connected to the data source, the form will retrieves all the fields from the SharePoint list as shown below:
- According to the specifications, we must now convert the Manager Data Card from a text field to a Dropdown control. Connect that dropdown control to the Office365Users connector to display the list of the user name.
- For this, select the edit form > go to Properties > Fields > Edit fields > Expand Manager.
- Again expand the control type. We can find various types of control types are there. From them, select Allowed values.
- We can now see that the Manager data card will be converted to a dropdown list, but it will initially display as blank.
- Let’s Unlock this data card to change the properties. By default, the ‘AllowedValues‘ property will display the expression as below:
AllowedValues = DataSourceInfo([@Employees], DataSourceInfo.AllowedValues, "Manager")
- To display the list of Office365 users on the Manager data card, we need to add a connector i.e., Office365Users to the canvas app.
- Insert the below expression on the AllowedValues property:
AllowedValues = Office365Users.SearchUser()
- Similarly, modify the Update property of the data card with the following expression:
Update = DataCardValue6.Selected.DisplayName
where DataCardValue6 is the name of the manager data card value.
- Finally, select the DataCard value or dropdown control under the manager data card, and set the value as DisplayName (on the right-side panel). We can see the user’s list on the Manager data card as shown below:
Now, we can see the text value of the Power Apps data card is updated to the people dropdown list.
To submit the data into the SharePoint list, add a button control to the Power Apps screen. Insert the below expression on the button’s OnSelect property.
OnSelect = SubmitForm(EmployeeRegistrationForm)
Where EmployeeRegistrationForm is the name of the Power Apps edit form.
Let’s save and preview the app. Fill out each field in the edit form as well as select the respective manager from the drop-down list. Then click on the Save button to save the data.
But we can see the choice value from the Manager field will be saved in a SharePoint text field, as shown below:
This is how to change the Power Apps data card to the drop-down control.
Conclusion
This Power Apps tutorial taught us how to change Power Apps DataCard to Dropdown control.
You may also like the following Power Apps tutorials:
- How to Update DataCard Value in Power Apps
- How to get month name from date in Power Apps
- How to Patch a Collection in Power Apps
- How to remove all items from a collection in PowerApps
- Power Apps Create Collection Using SharePoint List
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
Did not work against a SQL data gateway connection