cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
caballar
Level: Powered On

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

Re: Combobox Deletes Previously Entered Value When Editing Form

@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
Super User
Super User

Re: Combobox Deletes Previously Entered Value When Editing Form

Hi @caballar

 

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

 

JennieTodd
Level: Power Up

Re: Combobox Deletes Previously Entered Value When Editing Form

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

mangahere

Sru
Level 8

Re: Combobox Deletes Previously Entered Value When Editing Form

hi @caballar,

 

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

caballar
Level: Powered On

Re: Combobox Deletes Previously Entered Value When Editing Form

@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!

caballar
Level: Powered On

Re: Combobox Deletes Previously Entered Value When Editing Form

@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

Sru
Level 8

Re: Combobox Deletes Previously Entered Value When Editing Form

 Hi @caballar

 

Please refer below documentation link

 

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

 

Thanks,

Sru

Super User
Super User

Re: Combobox Deletes Previously Entered Value When Editing Form

Hi @caballar

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')?

 

caballar
Level: Powered On

Re: Combobox Deletes Previously Entered Value When Editing Form

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

Super User
Super User

Re: Combobox Deletes Previously Entered Value When Editing Form

@caballar

 

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

 

Parent.Default

Helpful resources

Announcements
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

Top Kudoed Authors
Users Online
Currently online: 238 members 4,156 guests
Please welcome our newest community members: