cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

Drop Downs on Edit Forms: Opening existing record, drop down shows first entry, not selected entry!

I have an Edit form with a DataCard including a Drop Down (Allowed Entries). When I create a new record I can select an entry from the drop down (which displays DiscountName) and the correct ID  (DiscountID) is stored in the table. But when I open an existing record, the DropDown always shows the first entry in the drop down instead of the correct entry for that record.

 

How to get the drop down to display the entry relating to the selected record?

 

Setup:

Form is bound to table OrderHeader which contains a field OrderDiscountID.

An OrderDiscountID data card is added to the form and set to AllowedEntries (so a Drop Down is displayed)

The DataCard is named: DataCardPayOrderOrderDiscountID

The DropDown is named: DropDownPayOrderOrderDiscountID

 

DataCard settings for DataCardPayOrderOrderDiscountID

DataField: "OrderDiscountID"

DisplayName: "OrderDiscountID"

Required: False

Default: ThisItem.OrderDiscountID

Update: DropDownPayOrderOrderDiscountID.Selected.OrderDiscount

AllowedValues: DataSourceInfo('[Order].[OrderDiscount]', DataSourceInfo.AllowedValues, "OrderDiscountID")

 

DropDown settings for DropDownPayOrderDiscountID

Items: Sort('[Order].[OrderDiscount]',OrderDiscountName)

Value: OrderDiscountName

Default: Parent.Default

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Drop Downs on Edit Forms: Opening existing record, drop down shows first entry, not selected ent

Ah - just figured it out!

 

The Default property for the drop down (the last line on my post above) needs to be a LookUp which takes the OrderDiscountID for the current item and uses it to look up the OrderDiscountName, like so:

 

LookUp('[Order].[OrderDiscount]',OrderDiscountID = ThisItem.OrderDiscountID,OrderDiscountName)

 

As someone with a background in Access this is really confusing. The Drop Down is 'sort of' bound in that when you select a DiscountName from the drop down, PowerApps does the work in the background to actually store the DiscountID. But when you are displaying an existing record, PowerApps doesn't bother to work out what DiscountName belongs to the DiscountID - you have to put in a LookUp yourself to do that.

 

Is it just me, or is that really counter-intuitive?

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Drop Downs on Edit Forms: Opening existing record, drop down shows first entry, not selected ent

Ah - just figured it out!

 

The Default property for the drop down (the last line on my post above) needs to be a LookUp which takes the OrderDiscountID for the current item and uses it to look up the OrderDiscountName, like so:

 

LookUp('[Order].[OrderDiscount]',OrderDiscountID = ThisItem.OrderDiscountID,OrderDiscountName)

 

As someone with a background in Access this is really confusing. The Drop Down is 'sort of' bound in that when you select a DiscountName from the drop down, PowerApps does the work in the background to actually store the DiscountID. But when you are displaying an existing record, PowerApps doesn't bother to work out what DiscountName belongs to the DiscountID - you have to put in a LookUp yourself to do that.

 

Is it just me, or is that really counter-intuitive?

View solution in original post

Highlighted
Advocate I
Advocate I

Re: Drop Downs on Edit Forms: Opening existing record, drop down shows first entry, not selected ent

How in the world did you figure this out?  I've spent weeks on this problem.  My background was Access first and then MS SQL.  I've been expecting some sort of defined relationship creating the "bound" values.  This is a feature that really needs to be worked on.  I feel like a lot of people would be wanting to build forms from relational databases at the 3rd normal form.  

 

Thanks for coming back and posting the answer!

 

Highlighted
Regular Visitor

Re: Drop Downs on Edit Forms: Opening existing record, drop down shows first entry, not selected ent

THIS IS SUPER COUNTER-INTUITIVE!  THANK YOU SO MUCH for persevering and then coming back to share. I have tried everything and just about decided it was impossible!!!  

 

We program in a lot of languages, and I've never seen anything quite like this.

 

Thank you!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,883)