cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sidhartha75
Level 8

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
Microsoft Employee

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

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

4 REPLIES 4
Microsoft Employee

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

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

mr-dang
Level 10

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

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
liamgsmith
Level: Powered On

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

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?

liamgsmith
Level: Powered On

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

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 521 members 5,714 guests
Please welcome our newest community members: