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

Dropdowns, SQL

Hi, I'm having some trouble replacing the default text fields with dropdowns on the edit screen.  Everything saves fine back and forth from SQL with the text fields.

 

  • Main Table
    • dbo.audits
      • Contains Company_ID, Contacts_ID, Industry_ID, etc.
  • Dropdowns 
    • POC_Exec, selection from current table, "2" should match ID from dbo.contacts table
      • Dropdown detail simply pulls the contact names from the table, is not tied to the "2" in the main table
    • Company_ID, selection from current table, "S" should match ID from dbo.company table
      • Dropdown detail simply pulls the company names from the table, is not tied to the "2" in the main table
  • Update for Card
    • Do I need to do anything special with the update?
      • I've seen in the past where I would put the following in...
        • Dropdown2.Selected.ID

2020-05-13_9-45-14.jpg

 

2020-05-13_9-59-28.jpg

 

2020-05-13_9-45-05.jpg

 

2020-05-13_9-59-07.jpg

4 REPLIES 4
Highlighted
Super User III
Super User III

Hi @ez1138 

Unlock the card, hide the textinput box and place a dropdown control into the card, say DropdownX.  Make sure that the card is selected so the dropdown is actually inside the card.  If you are saving the ID field from the dropdown, for example if there is a one to many relationship between the list in the Edit form and the list in the dropdown, click on the card and select the Update property. Remove the reference to the textinput control and replace it with DropdownX.Selected.ID. This will insert the Foreign key in your list. To work, your list must have the column the card is connected to as a Number.   If you are storing the actual value of the dropdown control in the list of the Edit form, then replace the Update property with DropdownX.Selected.Value or DropdownX.Selected.ActualNameOfField .  In that case, your SharePoint list should have that column as a Single line of text.  The key to saving the correct value in your list is the Update property of the card containing the control. 

FYI, although a dropdown control only shows one value in the window, but it actually contains the entire record and all the fields in the record can be referenced as described above even if they are not shown in the control's window.  

Highlighted

Thanks for the reply.  Here's what I have overall and have in place.  Hopefully I'm moving in the right direction.

 

From SQL, in my dbo.company table, I have Company_ID 1,2,3, etc. and a column Company_Name.

 

2020-05-13_11-19-46.jpg

2020-05-13_11-18-17.jpg

  • Inside the dbo.audit table I have Company_ID
    • In the company card, I did the text field, and added a dropdown with the following for Items
      • I've named it EditForm_Audits_Company_DataCard_Dropdown
      • '[dbo].[company]', Company_ID
        • It pulls up the first one, not the selected (Company 1)
      • I've set the updatefor the card
        • EditForm_Audits_Company_DataCard_Dropdown.Selected.ID

This Company_ID is from my dbo.audit that I'm working with.

 

2020-05-13_11-17-41.jpg

 

Not sure what I'm missing...lol

 

Highlighted

@ez1138 

The default property the dropdown control in the card should be Parent.Default. It sounds like it is still "1" from PowerApps dummy dataset for the control.

brain.jpg

Highlighted

Hi, the company should be pulling from the company table.  The table where I have "Company_ID", "Industry_ID" is different.  Parent.Default does not show anything when I added the dropdown.

 

Others have said that I should use something like this for the display?  I know it's wrong/wrong-ish.  It shows a warning but pulls the right information.  Maybe I should use this for edit.  Again, confused.

 

LookUp('[dbo].[company]', ID = DataCardValue89.Text, Company_Name)

 

The DataCardValue89 is the value of the card or "2".  The "2" pulls correctly from company table.

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,331)