cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Combobox Deletes Previously Entered Value When Editing Form

Hi,

 

I have a combobox in an Edit Form that is connected to a datasource dbo.Students. I can choose the student I want and submit the record fine. But when I open the record to edit other fields, the combobox value is cleared. I have to manually re-enter the combobox selction every time I edit the record, even if I just want to edit another field and leave the previous value for the combobox intact. I've tried changing the Update property of the datacard to something like If(IsBlank(Combobox1) ......  but no combinations of formulas have worked yet. 

 

I would like the combobox to not update or change previously selected values unless I click on it.

 

Can someone help with this please?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

@timl I was able to solve the problem. There is a Default property and also a DefaultSelectedItems property. When I use the Lookup formula in the DefaultSelectedItems property, and leave the Default property empty, everything works as it should. The formula for the DefaultSelectedItems property is LookUp('[dbo].[Semesters]',Semester=Parent.Default) 

 

Thanks for your help!

View solution in original post

12 REPLIES 12
timl
Super User
Super User

Hi @Anonymous

 

To configure a dropdown control on an edit form, there are 2 steps to carry out:

 

  • The first is to add formula to the Update property to update the data source, and it appears that you might have done this correctly if the form saves the correct data.
  • The second is to set the Default property so that the control displays the correct record when the form loads, and I suspect this is the bit you're missing. You would generally use the LookUp command to carry out this task.

Here's an answer that I wrote that provides a bit more guidance. Hopefully, this might be of some help to you.

 

https://powerusers.microsoft.com/t5/Creating-Apps/Drop-Down-Box-Lookup/m-p/82049#M827

 

Anonymous
Not applicable

Many thanks for your input. I hope someone knows the answer,

mangahere

hi @Anonymous,

 

have you tried using context variables ?

 

save the combobox selected value in a context variable

set combobox defaultselecteditems value with context variable

update context variable value when combobox changes.

 

Thanks,

Sru

Anonymous
Not applicable

@timl, thanks for your answer. I've tried the Lookup you suggested, but I must be getting the formula wrong. The combobox I am working with is drawing data from dbo.Semesters, which has these fields: Semester, AutoID (auto number and primary key). So the only editable field is Semester. 

 

The formula I tried was LookUp('[dbo].[Semesters]',Semester=Parent.Default) 

 

This only partially works because it returns the same default value for all semester records. For example, I have two records: Spring 2017 and Fall 2017. The formula above only returns the value for Spring 2017, even when I edit the record for Fall 2017.

 

In your example, there was a period and then "Name" at the end of your formula, but I kept getting errors whenever I would add a period and then choose a selction from intellisense.

 

Can you provide further assistance? Thanks!

Anonymous
Not applicable

@Sru Thank you for the suggestion. I am not familiar with update context formulas. Can you give an example of what the formulas would look like?

 

Thanks

 Hi @Anonymous

 

Please refer below documentation link

 

https://docs.microsoft.com/en-us/powerapps/working-with-variables

 

Thanks,

Sru

Hi @Anonymous

Just to clarify, what value do you want to store in your dbo.Students table? Do you intend to store the numeric AutoID value, or the text value (eg 'Spring 2017' or 'Fall 2017')?

 

Anonymous
Not applicable

@timl I am storing the text value "Spring 2017" etc.

@Anonymous

 

In that case, you should be able to set the default property to the following:

 

Parent.Default

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 (4,425)