Skip to main content

Notifications

Power Apps - Error Handling
Answered

Setting a default value of a dropdown menu

(0) ShareShare
ReportReport
Posted on by 10
Hello Guys,
 
i've tried quite a long time now and i can't figure it out.
 
I have a form in Powerapps with several datacards. One of them is called 'Projectcode'. Its Items property is set to a column in a sharepoint list and thus displays the options referencing to the entries in those column. That works more then fine.
 
As we want to speed up things and it is rather tedious to select out of all the projects we implemented a barcode scanner. The barcode scanner returns a string (varBarcode) formatted as text that contains a code (e.g. XY123). 
Now the problem: When i scan the my barcode and the variable varBarcode is set, then my dropdown menu should have this project with the same code as default.
So it should look for the correct options that is the same (yes, every code we scan is a option in the dropdown) and select that option as default.
 
Setting the Default property of my dropdown to: LookUp(ProjectOverview, Text(Projectcode) = varSV) is my best approach (atleast it doesnt give an error as many other tries) but it doesnt display anyhting
 
Could you please provide me a solution or point out where my brain is stuck? I am fairly new and that is anything else then logic for me...
 
Thank you in advance and have a great weekend.
 
Best, Oliver
  • Verified answer
    Mark Nanneman Profile Picture
    Mark Nanneman 831 on at
    Setting a default value of a dropdown menu
    Is your datasource SharePoint or Dataverse (or something else)?

    To change your default dropdown selected items for your edit form based on a variable try this:

    1. Go to the "Items" property of your Form's drop down.
    2. Copy the items expression from your drop down items property.
    e.g. 

    3.  Go to the "DefaultSelectedItems" property of your drop down
    Paste the items formula, and wrap it in a filter, try this template:
    Filter(Choices(<your-drop-down-choices>, Value = <your-search-variable>)
    e.g.


    If you're working with Dataverse, the Value property of your choices will be coded so that would involve extra steps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Kickstarter Events…

Register for Microsoft Kickstarter Events…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,858

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,505

Leaderboard

Featured topics