cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Power Apps Choices() Function for Dropdown Menu - Need an Initial Value of 'Select a type'

I am designing a Power App using a SPO list as the data source. I have a dropdown on the screen and a few text controls with a submit button that uses a Patch to write the data to the SP list. My dropdown's Items property uses the code below to populate the dropdown from the choices in my 'Employee-Type' list column. 

This works great however the dropdown is always pre-populated with a value and I want the initial value to be "Select an Employee Type". Any recommendations are greatly appreciated.

Choices('SPO-List-Name'.'Employee-Type')

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Power Apps Choices() Function for Dropdown Menu - Need an Initial Value of 'Select a type'

@bolin-stratus 

We have to add "Select an Employee Type" to top of the list of available options since there is no placeholder text property in a dropdown.

 

Put this code in the OnVisible property of your screen.

 

ClearCollect(myDropdownOptions, {Value: "Select an Employee Type"});
Collect(myDropdownOptions, Choices('SPO-List-Name'.'Employee-Type');

 

Then use the collection in the Items property of your dropdown

 

myDropdownOptions

 

Finally, write your placeholder text string in the Default value of the dropdown

 

"Select an Employee Type"

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
Highlighted
Dual Super User
Dual Super User

Re: Power Apps Choices() Function for Dropdown Menu - Need an Initial Value of 'Select a type'

The way I've done this in the past is to dump the data source field into a collection after I add the one additional choice that I want at the top of the collection.  Then use that collection in the Choices() formula.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Super User
Super User

Re: Power Apps Choices() Function for Dropdown Menu - Need an Initial Value of 'Select a type'

@bolin-stratus 

We have to add "Select an Employee Type" to top of the list of available options since there is no placeholder text property in a dropdown.

 

Put this code in the OnVisible property of your screen.

 

ClearCollect(myDropdownOptions, {Value: "Select an Employee Type"});
Collect(myDropdownOptions, Choices('SPO-List-Name'.'Employee-Type');

 

Then use the collection in the Items property of your dropdown

 

myDropdownOptions

 

Finally, write your placeholder text string in the Default value of the dropdown

 

"Select an Employee Type"

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
Super User
Super User

Re: Power Apps Choices() Function for Dropdown Menu - Need an Initial Value of 'Select a type'

Hi @bolin-stratus 

The easiest way is if you can access your SharePoint list, add _Select an Employee Type as an option and sort the list Ascending in PowerApps.  If not, you can create a collection that includes this option and then collect the rest of the data from SPO. 

Collect(emptype,Distinct(SPO-List-Name','Employee-Type')),Collect(emptype,{Result:"_Select an Employee Type"})

You would put this formula in the OnVisible property of your screen.  you can then use Sort(emptype, Result) as the items property of a dropdown control. 

Highlighted
Helper V
Helper V

Re: Power Apps Choices() Function for Dropdown Menu - Need an Initial Value of 'Select a type'

Thank you @mdevaney for providing a detailed solution!

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (7,172)