cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sidhartha75
Kudo Kingpin
Kudo Kingpin

Problem with selecting dropdown values(IDs) from Name in PowerApps

Hi All,

 

I am newly involved in Microsoft PowerApps Technology. I dont know is there any suggestion how to bind both ID and Name attribute to drop down list and fecting ID value while selecting any name from dropdown list.

 

I have two table, X and Y. I am storing Y Table ID in X Table. In PowerApps Edit screen I am going to show one drop down for Y Table values and it will show Name attribute in dropdown. When user will select any name then ID will store in X Table.

 

I am not able to store both ID and Name in drop down. I am using Y Table in the item ('[dbo].[Y]') property of dropdown and value using as Name. After that dont know what to do.

 

Please help on this.

1 ACCEPTED SOLUTION

Accepted Solutions
Maxwell
Microsoft
Microsoft

Hey Sidhartha75,

 

  With a dropdown control, you're selecting an entire record, not just the field that's being displayed. For instance, imagine that we have a table full of records that have both an "ID" and a "Name" field. We can create a dropdown menu and set its "Items" property equal to this table. Under the "Advanced" tab of the sidebar UI, we can tell this dropdown that we want it to display the "Name" field of each record, by setting that under "Value" (This is under "Data" and "Items"). Even though only the "Name" is being displayed, you can still reference the other fields.

Dropdown1.Selected.ID
Dropdown1.Selected.Name

Was this what you were you trying to accomplish?

  Maxwell, PowerApps-Staff

View solution in original post

4 REPLIES 4
Maxwell
Microsoft
Microsoft

Hey Sidhartha75,

 

  With a dropdown control, you're selecting an entire record, not just the field that's being displayed. For instance, imagine that we have a table full of records that have both an "ID" and a "Name" field. We can create a dropdown menu and set its "Items" property equal to this table. Under the "Advanced" tab of the sidebar UI, we can tell this dropdown that we want it to display the "Name" field of each record, by setting that under "Value" (This is under "Data" and "Items"). Even though only the "Name" is being displayed, you can still reference the other fields.

Dropdown1.Selected.ID
Dropdown1.Selected.Name

Was this what you were you trying to accomplish?

  Maxwell, PowerApps-Staff

View solution in original post

mr-dang
Community Champion
Community Champion

If I understand correctly, you want your dropdown menu to show the contents of two columns in your datasource, but you have two problems:

  • your data is in two different Tables
  • the Dropdown can only set one column in the Advanced panel

 

I have a solution with two steps:

  1. Add a column to '[dbo].[Y]' that looks up the ID in '[dbo].[X]'. Add a column that concatenates Name and the ID that has been looked up. Or you can complete these two columns together.
  2. Set the Dropdown to the concatenated column.

 

Step 1

The formula below adds a column "NameID" which results in a the ID number and the existing name (i.e. "294732 Brian"). Change the lookup to meet your needs--I just made a generic lookup formula for the ID.

Dropdown1.Items:
AddColumns('[dbo].[Y]',"NameID",LookUp('[dbo].[X]',IdentifyingColumn=Name,ID) & " " & Name)

Step 2

Next, show the Advanced panel for Dropdown1. Set the Value to the "NameID" column that you just created. It should show the concatenated result now.

Microsoft Employee
@8bitclassroom

hi @Maxwell Just to add on here - I've done exactly this - reference the other table and shown the 'Name' as the Value rather than the 'ID' column, however my form won't submit as it's complaining about missing data.

If I swap it to Value = id, then the form submits ok, so my query is how to have the form show the name, but submit the id?

Figured out that I needed to change the Update property for the dropdown to be 'Dropdown1.Selected.id' and not 'Dropdown.Selected.Name'

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,317)