web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to retrieve dropdo...
Power Apps
Answered

How to retrieve dropdown selected value having data source as Lookup table

(0) ShareShare
ReportReport
Posted on by 29

Hi Team,

 

I have a simple form with three text fields and a DropDown control. The issue that I face is as below.

1) The Datasource of the whole form is from a single table named Milestone.

2) The data source for the dropdown is a field (Project_Id) that is type Lookup and mapped to another table named Project (Foreign Key). 

 

Below is the table Milestone where Project_Id is a Lookup field

mehardikdave_1-1611236955477.png

Below is the Project table having Projectid as Unique field.

mehardikdave_0-1611236851092.png

 

To give more context, below are the details of the Project table with important fields been highlighted

mehardikdave_2-1611237362056.png

 

 

3) When I run the screen, I can see actual values of the Project names in the dropdown. Till now everything works fine.

4) What I wanted is, when I select any value from the dropdown, I want the selected text to be copied to a TextBox which I made visible false so as to capture the selected values from the DropDown. My only reason to have an extra textbox is to capture the value of the dropdown. If you guys can suggest a better option then nothing like that.

 

What steps I did:

1) In the OnChange event of the DropDown, I wrote below UpdateContext code, which is not working

UpdateContext({selectedTrade:Lookup([@Projects], Community=drpProjects.Selected.Value, Name))

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @mehardikdave ,

     

    Could you tell me:

    What’s the data type of Community column? Is it a text column?

    Do you want to display the contents of the Milestone table in the dropdown control and the name of the Project table in the label control?

     

    I assume:

    You want to display the value of the name column of the Milestone table in the dropdown control.

    You want to display the value of the Name column of the Project table in the label control.

     

    I did a test for you

    1\ This is my test Milestone table and Project table.

    v-xiaochen-msft_0-1611308327881.png

     

    v-xiaochen-msft_1-1611308327882.png

     

     

    2\ Add a dropdown control and set its Items property to:

    Milestones

     

    Set the onchange property of the dropdown control to:

    UpdateContext({selectedTrade: LookUp(Milestones,Milestone=Dropdown1.Selected.Milestone).Project_Id.Name}) 
    
    // Dropdown1 is the name of my dropdown control.
    
    // Milestone is Unique Identifier.

     

    3\ Add a label control land set its Text property to:

    selectedTrade

     

    4\ The result is as follows:

     MMM.gif

     

    Best Regards,

    Wearsky

    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • mehardikdave Profile Picture
    29 on at

    That worked. Thanks

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard