cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PaulD1
Community Champion
Community Champion

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
PaulD1
Community Champion
Community Champion

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

5 REPLIES 5
PaulD1
Community Champion
Community Champion

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?

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!

 

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!

aweedman
Frequent Visitor

Yes, this is dumb. Can't believe that it hasn't been fixed yet.

geddb
Helper I
Helper I

Hi @PaulD1,

 

I'm having all sorts of difficulty with a similar problem. I've been working on this for days and I feel like I'm going around in circles and was hoping you may be able to help me out:

 

I have two forms on one EDIT screen and because there is two forms, I have had to add an independent dropdown (dd1) OUTSIDE of both forms. If dd1 = 'y', then form2 is visible but if dd1 contains 'a','b','c','d','e' or 'z', then form 1 is visible. Furthermore, if dd1 changes from 'y' then form1 is visible.

 

I think everything else is working fine but I just can't get the dropdown to show the item associated to the record when in EDIT mode. It shows the first item in the dropdown. I've tried the Lookup but just can't seem to get the syntax right. I get this far and can't add 'Enquiry Type' in the RESULT attribute of the Lookup (it only allows me to choose between 'Enq ID' and ThisRecord, neither giving me the desired result.

 

geddb_1-1660531399119.png

geddb_2-1660531697441.png

The above screenshot gives the error 'Enquiry Type' isn't recognised'

 

DataSource: 'OVG WIP Tracker'

Record ID: EnqID

DropDown Field: 'Enquiry Type'

Form DropDown: DataCardValue122

Form Record ID: DataCardValue1_4 (Text)

 

geddb_0-1660530970712.png

 

Sorry about the long winded explanation for what should be a simple fix. I'm relatively new to Powerapps. All I need is to have the form show the Enquiry Type from the selected record (in this case of the screenshots 'General') instead of the first item in the dropdown list when the user clicks EDIT. If you can help in any way I will be immensely appreciative.

 

Sincere thanks in advance.

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,275)