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

Populating previously selected options in a combo box

Hello

 

We're storing selected options from the combo box into a SharePoint list. When the user goes back in to their form we need those options to show within the combo box. Is that possible yet?

4 REPLIES 4
Super User
Super User

Re: Populating previously selected options in a combo box

@StuPower 

Yes, this is all possible with the DefaultSelectedItems property of the ComboBox.  

However, if you are using this in an EditForm, then the datacard will provide this functionality for you without having to change anything.

If you are using the ComboBox outside of an edit form, then you will need to supply the logic to the DefaultSelectedItems property of the control.

 

If you still have questions, please provide some more specific examples, screenshots or formulas that might be helpful in deducing your problem.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
StuPower
Level: Powered On

Re: Populating previously selected options in a combo box

@RandyHayes 

 

Thanks

 

So ive had a play and i can see ComboBoxes arent as easy as normal field with regards to patching

 

i.e this won't work -

Patch('Objective Setting_1',Defaults('Objective Setting_1'),{Links to strategy:ComboBox.SelectedItems}

Ive found posts which use something like this

{'Links to strategy':ForAll(ComboBox.SelectedItems,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:Value})}

But this code dosen't work either.

 

So to over come this ive used concat and placed the values into a label and then patched the labels value into SharePoint. This part is fine for what i need.

 

But i now can't prepopulate those values back into the combobox using "defaultselecteditems" when i select my record from a gallery as from my understanding its needs a Value and a ID?

DefaultSelectedItems: ObjectiveRecord.'Links to strategy'

 

Any help is greatly appreciated as documentation on this field seems very scarce

 

Super User
Super User

Re: Populating previously selected options in a combo box

@StuPower 

Actually, you might be overcomplicating things for yourself a bit.  

The first formula actually does work and works fine.

Patch('Objective Setting_1',Defaults('Objective Setting_1'),{Links to strategy:ComboBox.SelectedItems}

So, if that is not working for you, then I'd suggest getting to the root cause of that problem rather than create another method to work around it.  That will just bring you more grief. 

 

If the above is not working, then there are at least two things to look at first:

1) The definition of your column.  This is most important.  Are we looking at a Choice column (I assume) and what kind of parameters are set for it?  Does it allow multi-select?  Does it allow add-in choices?  (Are you trying to add in choices? ) Does it have any other conditions to it?

2) The Items of your ComboBox - they should be a table of Value records...that is all you need for the above to work. Best choice is the Choices function as it was designed to give you the viable choices for a column  If you are doing anything different (such as Distinct or filter or other) you will need to pre-shape the items data into a table of Value records.

 

Based on those two observations, you should be able to get to the root cause of why your patch statement doesn't work.

BUT...the point being - that patch statement should work fine if the proper conditions are set up for it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Administrator
Administrator

Re: Populating previously selected options in a combo box

Hi @StuPower can you review the above reply and update the thread if it was helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

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